コンテンツにスキップ

js 変数の型判別#

primitive型#

console.log(typeof 42);
// expected output: "number"

console.log(typeof 'blubber');
// expected output: "string"

console.log(typeof true);
// expected output: "boolean"

console.log(typeof undeclaredVariable);
// expected output: "undefined"

class#

if(dog instanceof Animal){

}

References#

Tags#

  • #js