Values & Types — What JavaScript Actually Has — Concept Check
Questions on Values & Types — What JavaScript Actually Has. JavaScript has seven primitive types and one object type. Everything that is not a primitive — arrays, functions, dates, regexes — is an object, and that single fact explains most surprising behaviour in the language.
Questions in this quiz
7 questions on Values & Types — What JavaScript Actually Has — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.You have a variable `x` assigned with `null`. What will `typeof x` return?
- A'object'
- B'primitive'
- C'null'
- D'undefined'
2.Given `let a = 42; let b = a; b = 50;`, what is the value of `a` after these operations?
- ANaN
- Bundefined
- C50
- D42
3.What will `0.1 + 0.2 === 0.3` evaluate to in JavaScript?
- Afalse
- BNaN
- Cundefined
- Dtrue
4.How can you reliably check if a variable `arr` is an array?
- Aarr instanceof Array
- Barr.constructor === Array
- CArray.isArray(arr)
- Dtypeof arr === 'array'
5.What happens when you assign an object to another variable in JavaScript?
- AThe object is cloned
- BThe reference is copied
- CThe object is converted to a string
- DThe object is converted to a primitive
6.Why might `9007199254740992 === 9007199254740993` evaluate to `true` in JavaScript?
- AJavaScript optimizes large numbers
- BBoth are converted to strings
- CJavaScript treats them as BigInts
- DNumber precision limits
7.Which of the following is a primitive type in JavaScript?
- Aarray
- Bfunction
- Csymbol
- Ddate