Basic but vague
1.typeof null
object
This is a legacy issue, null is not actually an object.
2.”==” & “===”
former: loose
latter: strict
console.log(18 == ‘18’); // true
console.log(18 === ‘18’); // false
3.typeof NaN
number
4.String concatenation of the + operator
1 | console.log('5' + 5);//"55" |
“+” is different from “-“ in this field.
5.”undefined” & “null”
former: declared but not assigned
latter: declared and assigned a null value
6.NaN === NaN ?
amazingly wrong
we need to use a func called “isNaN()”
7.boolean about “0” & “ “
both false
Challenge
- declare function prompt(message?: string, _default?: string): string | null;
1 | // const favourite = Number(prompt("What's your favourite number?")); |