What Are the Three Primitive Data Types in JavaScript?
The three core JavaScript primitives, string, number and boolean, with examples and a note on the seven types the language really has.
466 posts about JavaScript: questions with answers, tutorials and articles, newest first.
The three core JavaScript primitives, string, number and boolean, with examples and a note on the seven types the language really has.
Primitives are immutable and copied by value, while objects and arrays are shared by reference. See how that affects assignment, comparison and copying.
JavaScript is usually grouped into client-side and server-side code. Learn how the two environments differ, with examples for the browser and Node.js.
Boolean is a primitive type with two values. Learn the complete falsy list, explicit conversion, and why new Boolean(false) is truthy.
Date is a mutable object that wraps a millisecond timestamp. Learn how to compare, copy, validate and format dates without the usual pitfalls.
null is a primitive value in JavaScript, even though typeof null returns object. Learn why, how to test for it, and how to handle it safely.
JavaScript uses one Number type for integers and decimals. Learn why 0.1 + 0.2 is off, how to compare floats safely and how to handle money.
In JavaScript a string is one of seven primitives. This article explains why and compares how Java, Python, C and Go classify strings.
The seven primitive types in JavaScript explained with examples: string, number, bigint, boolean, undefined, null and symbol, plus typeof and falsy values.
JavaScript became universal because browsers require it and runtimes like Node.js carried it to servers, mobile and the edge. See where it fits and where it does not.
JavaScript trips up beginners with async timing, type coercion, scope and the `this` keyword. Each pitfall below has a short example and a fix.
JavaScript remains a core hiring skill because the web depends on it. See which skills employers want, from TypeScript to frameworks, and how to compete.
JavaScript owns the browser, Python leads in data and AI. Compare syntax, performance and use cases side by side and choose the right one.
Java and JavaScript only share part of a name. Compare how they are typed, run and used, with side-by-side code and advice on which to learn first.
Load JavaScript from an external file with defer in the head so it never blocks rendering. Compare head, body end, async, inline and module scripts.
What JavaScript does best, from front-end interfaces and Node.js APIs to cross-platform apps, plus the cases where another language fits better.
JavaScript works for front ends, servers, mobile and desktop apps, tools and serverless. See what it covers and where to use other languages.
JavaScript runs interactive websites, server APIs, mobile and desktop apps, games and developer tools. See real-life uses with short runnable examples.
JavaScript runs in every browser for frontend work and on servers through Node.js, Deno and Bun. See how each side works, with examples.
JavaScript also runs servers, mobile and desktop apps, games, IoT devices and command-line tools. See the main non-web uses with working examples.