String,Number,Boolean
String
String
Number
//tofixed()方法用于返回指定小数点位数的数值字符串,括号里面写保留多少位小数,若小数位超过指定的位数则四舍五入
let num = 10;
console.log(num.toFixed(2)); //"10.00"
let num1 = 10.005;
console.log(num1.toFixed(2)); //"10.01"
//toExponential()方法用于返回科学计数法的数值字符串,括号里面写保留多少位小数
let num2 = 20;
console.log(num2.toExponential(1)); //"2.0e+1"
Boolean
//new Boolean()是构造函数,Boolean()是转换函数
let boo1 = new Boolean(false);
let boo2 = false;
console.log(boo1 instanceof Boolean); //true
console.log(boo2 instanceof Boolean); //false