🌐
W3Schools
w3schools.com › js › js_types.asp
JavaScript Datatypes
JS Data Types JS Primitive Data JS Object Types JS typeof JS toString() JS Type Conversion JS Errors · JS Errors Intro JS Errors Silent JS Error Statements JS Error Object JS Debugging
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › primitive-and-non-primitive-data-types-in-javascript
Primitive and Non-primitive data-types in JavaScript - GeeksforGeeks
Primitive data types are the built-in data types provided by JavaScript. They represent single values and are not mutable.
Published   July 23, 2025
Discussions

javascript - object vs. primitive - Stack Overflow
You mentioned that you assume that ... to JavaScript. I think you should have asked him just to be sure -- no point in guessing about what he's asking when a simple question would have clarified that. ... Good advice, determining what he was getting at would have helped. ... A primitive is a data type that is composed ... More on stackoverflow.com
🌐 stackoverflow.com
Confusion between Objects and primitive data types in Js
Now, cat is a variable of data type of object, and the object data represents the different key/value pairs (propreties), or the cat is an object? It's the same thing. Technically cat is a variable, and it holds an object (to be even more technical, it holds a reference to an object, but that's not the point). Saying "cat is an object" is a fairly common colloquial way to describe a variable and its type. For instance... let x = 1; I might say "x is a number". It's actually a variable that holds a number, but programmers are going to understand that's what I meant. More on reddit.com
🌐 r/learnprogramming
5
1
May 2, 2022
Everything in JavaScript is an object...what about primitive data types?
Primitives are not objects. When you call a method on them they are temporarily wrapped in an object and unwrapped when the method is executed. More on reddit.com
🌐 r/learnjavascript
36
57
June 11, 2022
If string is a primitive then why does it list a bunch of methods when I print out it's prototype?
Same docs answer this question imo: Most of the time, a primitive value is represented directly at the lowest level of the language implementation. All primitives are immutable; that is, they cannot be altered. It is important not to confuse a primitive itself with a variable assigned a primitive value. The variable may be reassigned to a new value, but the existing value can not be changed in the ways that objects, arrays, and functions can be altered. The language does not offer utilities to mutate primitive values. Primitives have no methods but still behave as if they do. When properties are accessed on primitives, JavaScript auto-boxes the value into a wrapper object and accesses the property on that object instead. For example, "foo".includes("f") implicitly creates a String wrapper object and calls String.prototype.includes() on that object. This auto-boxing behavior is not observable in JavaScript code but is a good mental model of various behaviors — for example, why "mutating" primitives does not work (because str.foo = 1 is not assigning to the property foo of str itself, but to an ephemeral wrapper object). More on reddit.com
🌐 r/learnjavascript
9
10
November 13, 2022
People also ask

What are data types in JavaScript?
Data types in JavaScript define the kind of values you can store and use in a program. They help you manage and perform operations on different kinds of data efficiently.
🌐
wscubetech.com
wscubetech.com › resources › javascript › data-types
JavaScript Data Types: Primitive & Non-Primitive With Examples
What are the different data types in JavaScript?
There are two major types of data types in JS:Primitive: String, Number, Null, Boolean, Undefined, BigInt, and SymbolNon-primitive: Object, Array, Function
🌐
wscubetech.com
wscubetech.com › resources › javascript › data-types
JavaScript Data Types: Primitive & Non-Primitive With Examples
How many data types are there in JavaScript?
There are two main data types in JavaScript: Primitive and Non-Primitive. Primitive data types include seven types: String, Number, Boolean, Null, Undefined, BigInt, and Symbol, while non-primitive types include Object, Array, and Function.
🌐
wscubetech.com
wscubetech.com › resources › javascript › data-types
JavaScript Data Types: Primitive & Non-Primitive With Examples
🌐
Frontend Mentor
frontendmentor.io › articles › understanding-primitive-and-reference-types-in-javascript-J2SJg1t3vw
JavaScript Primitive vs Reference Types Explained
April 11, 2024 - Whether you're a beginner or a seasoned developer, this guide will help you gain a solid grasp of JavaScript data types. Let's begin. Primitive types are stored directly in memory and are easy and fast to manipulate, unlike more complex reference types.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Glossary › Primitive
Primitive - Glossary | MDN
In JavaScript, a primitive (primitive value, primitive data type) is data that is not an object and has no methods or properties. There are 7 primitive data types:
🌐
EDUCBA
educba.com › home › software development › software development tutorials › javascript tutorial › primitive data types in javascript
Primitive Data Types in JavaScript | Essential Data Types & Structures
March 28, 2023 - Primitive Data Types in JavaScript are majorly divided into two i.e. Primitive data types and user-defined datatypes. Primitive data types are the built-in data structures defined in the system for the language.
Address   Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
GitConnected
levelup.gitconnected.com › primitive-vs-non-primitive-value-in-javascript-82030928fd9
Primitive vs Non-Primitive Value in Javascript? | by Ayush Tibra | Level Up Coding
June 15, 2022 - Primitives are known as being immutable data types because there is no way to change a primitive value once it gets created.
🌐
WsCube Tech
wscubetech.com › resources › javascript › data-types
JavaScript Data Types: Primitive & Non-Primitive With Examples
November 5, 2025 - Learn about JavaScript data types: Primitive & Non-Primitive with examples. Explore strings, numbers, objects, arrays, and more in this comprehensive guide.
Find elsewhere
🌐
JavaScript Tutorial
javascripttutorial.net › home
JavaScript Tutorial
December 13, 2024 - Number – learn how JavaScript uses the Number type to represent the integer and floating-point numbers. Numeric Separator– show you how to make the numbers more readable by using underscores as numeric separators. Octal & binary literals – provide support for binary literals and change the way to represent octal literals. Boolean – introduce you to the Boolean type. String – learn about string primitive type and some basic string operations.
🌐
ScholarHat
scholarhat.com › home
Data Types in JavaScript: Primitive & Non-Primitive
September 22, 2025 - The eight basic data types in JavaScript are classified into two categories: Primitive data types are predefined or built-in data types in JavaScript that can hold simple values.
🌐
Scaler
scaler.com › home › topics › javascript › javascript data types
JavaScript Data Types - Scaler Topics
February 29, 2024 - The primitive data types in Javascript are those which are defined at the basic level and cannot be destructured further, whereas non-primitive data types in javascript are those that can be manipulated using methods and can create objects.
🌐
Medium
medium.com › @rajeswaridepala › javascript-primitive-datatypes-made-easy-by-depala-rajeswari-f0591bcad6a4
JavaScript Primitive Datatypes Made Easy | by Rajeswari Depala | Medium
January 24, 2025 - JavaScript Primitive Datatypes Made Easy Primitives are the most basic data types in JavaScript, representing simple, immutable values. The primary primitives include: String: A sequence of …
🌐
CodeWithHarry
codewithharry.com › tutorial › primitive-and-objects
Data Types: Primitives and Objects | JavaScript Tutorial | CodeWithHarry
That’s why primitives are considered immutable — their actual values can’t be altered once they exist. Objects in JavaScript are more powerful and flexible. They can store multiple pieces of data and represent real-world entities like users, cars, or products. ... Keys are usually strings. Values can be any type (including other objects or primitives).
🌐
Ruslan Yusupov
ruslanyusupov.com › javascript-tutorial › primitive-data-types
Primitive Data Types | Ruslan Yusupov
September 1, 2021 - JavaScript has 7 primitive data types. Number, String, Boolean, Undefined, Null, Symbol, BigInt
🌐
33jsconcepts
33jsconcepts.com › concepts › primitive-types
Primitive Types - 33 JavaScript Concepts
January 7, 2026 - These seven primitive types are the foundation of all data in JavaScript. Unlike objects, primitives are immutable (unchangeable) and compared by value.
Top answer
1 of 5
49

A primitive is a data type that is composed of no other data types and can not be broken down any further. It is like the atoms in the programming scenario. I say atom because atom is a basic unit of matter and there is nothing that can be derived from it.

I mean, an int in C can not be broken down into smaller data type. An object, on the other hand can be thought of a molecule, consisting of more than one primitive type. For example, string comes as part of the C++ standard library; however, it is an object and it is composed of smaller data types internally and contains methods.

It is important to note that not all object-oriented languages are class based (eg. Javascript) You can not define a class in Javascript, so an object is quite different here. Even though everything in Javascript is an object (Ruby also), the Number object is really a wrapper for an internal primitive.

2 of 5
27

From Java perspective:

  1. A primitive is not composed of other data types. Where as an object can be and generally is.
  2. Primitives are passed by value, i.e. a copy of the primitive itself is passed. Whereas for objects, the copy of the reference is passed, not the object itself.
  3. Primitives are independent data types, i.e. there does not exist a hierarchy/super class for them. Whereas every Object is descendent of class "Object".
  4. Every object has some default methods of itself, which it inherits from the class Object (e.g. toString(), clone(), wait(), notify(), notifyAll(), etc.). The primitives does not have any method associated with themselves.
  5. Primitives are immutable, they can be used as so without any special care. Whereas for objects, special care needs to be taken, they are not immutable by default.
  6. With objects, there are two types of copies, Shallow and Deep. There is a significant difference between them. So the choice depends on how do we intend to use them. With primitives, there is no such difference, everything is by default deep copy only.
🌐
FlatCoding
flatcoding.com › tutorials › javascript › data-types-in-javascript-primitive-and-non-primitive
Data Types in JavaScript: Primitive and Non-Primitive
June 23, 2025 - JavaScript archives provide you with a list of articles to help you develop skills. Click here to see more articles with examples.
🌐
JavaScript in Plain English
javascript.plainenglish.io › primitive-and-reference-data-types-in-javascript-2b3916cae1ef
Primitive and Reference Data Types in JavaScript | by Patric | JavaScript in Plain English
May 24, 2021 - Data Type null indicates that there is an object missing or invalid. Special primitive type having additional usage for its value: if the object is not inherited, then null is shown;
🌐
D3
d3js.org
D3 by Observable | The JavaScript library for bespoke data visualization
Encode abstract data into visual values such as position, size, and color. Explain position encodings with axes. Render arcs, areas, curves, lines, links, pies, stacks, symbols… and any geometric primitive you might need to visualize data.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects
Standard built-in objects - JavaScript | MDN
They include the basic Error type, as well as several specialized error types. ... These are the base objects representing numbers, dates, and mathematical calculations. ... These objects represent strings and support manipulating them. ... These objects represent collections of data which ...
🌐
W3Schools
w3schools.com › js › js_datatypes.asp
JavaScript Data Types
JS Examples JS HTML DOM JS HTML Input JS HTML Objects JS HTML Events JS Browser JS Editor JS Exercises JS Quiz JS Website JS Syllabus JS Study Plan JS Interview Prep JS Bootcamp JS Certificate JS Reference · ❮ Previous Next ❯ · A JavaScript variable can hold 8 types of data. 7 Primitive Data Types and 1 Object Data Type.