javascript primitive

jsのプリミティブ型

・真偽値 boolean
・文字列 string
・null値 null
・未定義値 undefined

プリミティブ型は、通常は値そのものだが、
一時的にオブジェクトになるケースがある。
なお、nullとundefinedは常にプリミティブ型。

var num1 = 100;
var num2 = new Number(200);

console.log(typeof num1);//number
console.log(typeof num2);//object

console.log(num1);//100
console.log(num2);//Number {[[PrimitiveValue]]: 200}

console.log(num1.toString());//100
console.log(num2.toString());//200