基本型とObject
キーワード: typeof
, instanceof
型
- undefined
- boolean
- string
- number
- symbol
- function
- object
- Array
- Map
- Date
型チェック
typeof
演算子で行える
console.log(typeof true) // boolean console.log(typeof 'str') // string console.log(typeof 100) // number console.log(typeof Symbol()) // symbol console.log(typeof undefined) // undefined console.log(typeof function abc(){}) // function console.log(typeof {name: 'yoshimoto' }) // object console.log(typeof [1, ,2, 3, 4]) // object console.log(typeof new Date()) // object