Primitive vs Non-Primitive Data Types Explained (JavaScript)
Primitives are immutable values compared by value, while objects are handled by reference. See the practical differences in copying, comparing and mutating, with examples.
466 posts about JavaScript: questions with answers, tutorials and articles, newest first.
Primitives are immutable values compared by value, while objects are handled by reference. See the practical differences in copying, comparing and mutating, with examples.
JavaScript has no separate float type; all numbers are 64-bit doubles. Learn the precision limits, safe comparisons, BigInt and how to handle money.
Date is a reference type that wraps a millisecond timestamp. See how to create, copy, compare, validate and format dates without common bugs.
Learn how to tell primitive values from objects in JavaScript and how copying, equality and freezing differ, including shallow versus deep copies.
Arrays, objects, Maps and Sets cover most data storage in JavaScript. See examples, a comparison table and when to use each one.
The seven JavaScript primitive types with examples, typeof results, and how immutable primitives differ from objects.
JavaScript has seven primitive types, including bigint added in ES2020. See each type with examples, typeof results and how primitives differ from objects.
Strings are primitive, immutable values in JavaScript. See how auto-boxing gives them methods and why new String() should be avoided.
JavaScript primitives such as strings, numbers and booleans cannot be changed after creation. See examples, the const difference and how objects differ.
JavaScript strings are immutable primitives. See how they differ from String objects, how methods work on them and how to check types safely.
A complete reference to the seven JavaScript primitives with typeof results, ES versions and short code examples, plus how primitives differ from objects.
JavaScript Date is an object, not a primitive. See how reference semantics, comparison, validation and JSON behave, and where Temporal fits in.
String, number, boolean and undefined are the first JavaScript data types to learn. See examples, the full list of eight types and typeof quirks.
Arrays are objects, not primitives, so assignment and function calls share the same data. Learn the primitive types and how to copy arrays safely.
JavaScript has seven primitive types and one object type. Learn each type, why older guides list seven, and how typeof reports them, with examples.
JavaScript's classic primitives are string, number, boolean, undefined and null. Symbol and bigint raise the count to seven. See examples and typeof results.
== compares primitive values and object references, while equals() compares object content. See when to use each in Java, with Python and JavaScript equivalents.
JavaScript compares with ==, === and !=. See how loose and strict equality differ, why === is preferred, and how relational operators and Python compare.
The == operator compares two values, but its meaning differs by language. Learn the pitfalls in JavaScript, Python, Java and C with clear examples.
The == operator compares values. See how JavaScript coerces types, why === is usually safer, and how Python == differs from is.