1var e=[{id:`prim-typeof-table`,lessonId:`primitives`,prompt:`What does this log?`,lang:`js`,code:`console.log(typeof null, typeof undefined, typeof NaN); 2console.log(typeof function () {}, typeof Symbol(), typeof 10n);`,answer:`object undefined number 3function symbol bigint`,why:"`typeof null` is the famous 1995 tagging bug, kept forever for compatibility. `NaN` is a number value, and `function` is the one non-primitive typeof reports specially."},{id:`prim-null-check`,lessonId:`primitives`,prompt:'Why is `typeof x === "object"` not a safe object check, and what is?',answer:'It is true for `null`. Use `x !== null && typeof x === "object"`, or `Object(x) === x`.',why:`The typeof bug makes null the one primitive that masquerades as an object, and it is the single most common source of "cannot read properties of null".`},{id:`prim-autobox-write`,lessonId:`primitives`,prompt:`What does this log, in sloppy mode?`,lang:`js`,code:`const s = 'hi'; 4s.x = 1; 5console.log(s.x);`,answer:`undefined`,why:`Each property access autoboxes into a fresh temporary String object; the write lands on that throwaway and it is discarded immediately, so the read boxes a brand-new one.`},{id:`prim-wrapper-equality`,lessonId:`primitives`,prompt:`What does this log?`,lang:`js`,code:`console.log(new String('a') == 'a'); 6console.log(new String('a') === 'a'); 7console.log(Boolean(new Boolean(false)));`,answer:`true 8false 9true`,why:"Wrapper objects are objects: `==` unwraps them via ToPrimitive, `===` never does, and every object is truthy â even one wrapping `false`."},{id:`prim-symbol-identity`,lessonId:`primitives`,prompt:`What does this log?`,lang:`js`,code:`console.log(Symbol('a') === Symbol('a')); 10console.log(Symbol.for('a') === Symbol.for('a'));`,answer:`false 11true`,why:"The description is a label, not an identity â every `Symbol()` call mints a unique value. `Symbol.for` is the opt-in global registry for when you do want sharing."},{id:`prim-symbol-keys`,lessonId:`primitives`,prompt:`What does this log?`,lang:`js`,code:`const k = Symbol('k'); 12const o = { [k]: 1, n: 2 }; 13console.log(Object.keys(o)); 14console.log(JSON.stringify(o));`,answer:`[ 'n' ] 15{"n":2}`,why:"Symbol keys are skipped by `Object.keys`, `for...in` and `JSON.stringify` â that invisibility is exactly why they are used for metadata that must not collide with user data."},{id:`prim-seven`,lessonId:`primitives`,prompt:`Name the seven primitive types, and say what makes them primitive.`,answer:`string, number, bigint, boolean, undefined, symbol, null. They are immutable values compared by value;
15 everything else is an object compared by reference.`,why:`The value-vs-reference split is what explains assignment, argument passing and equality across the whole language â it is one rule, not seven special cases.`}];export{e as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.