Loading topic
let and const, write and call functions, and create object and array literals. You should also be able to run snippets in a browser console or Node.js. The previous chapter listed the seven primitive types and the object type. This one explains4 min readtypeof. JavaScript has two values that mean "no value": undefined and null. Each is the only value of its own primitive type. They beha4 min readNaN == NaN being false or Number("abc") producing NaN, follow from how the Number type works. This chapter explains that model.3 min readNumber.MAX_SAFE_INTEGER. It also assumes you are comfortable running snippets in a browser console or Node.js. Here you will learn what BigInt adds, why JavaScript throws instead of quietly converting betw3 min readtypeof returns. Those topics were covered earlier. Here we answer a question those chapters left open: if a primitive is not an object, how can "hello".toUpperCase() work?3 min readnull and undefined, and the Number edge c3 min read-, *, and < only work on primitives, and so do template literals. When you give one of them an object, JavaScript4 min read"default", "number", and "string" hints. Here you apply them to operators. The + operator is the one that needs care, because it does two jobs: numeric addition and string concate4 min readNaN, -0, and floating-point precision. You will also need a browser console or Node.js to run the examples.4 min read==. The specification calls it IsLooselyEqual. Once you know its steps, results like [] == ![] stop looking random. You can trace each 4 min readnull and undefined, both covered in earlier chapters. It builds on them to explain what the logical operators actually return, when they stop evaluating, and how to pick between || and ?? 4 min readtypeof returns for each type, including the typeof null quirk. It also assumes you know that primitives such as strings get methods through temporary wrapper objects. Here the goal is practical: for each kind of value you might need to detect, which check gives4 min read==, +, and the relational operators apply them. This chapter turns those rules into habits that keep coercion from surprising you or the p4 min read