//基本数据类型:string boolean number null undefined
//引用类型 object
//typeof null === 'object' 字符串
//内置对象 String Number Boolean Object Function Array Date RegExp Error Math
var str1 = "abx";//字面量
var str2 = new String('xyz');
str1 instanceof String;//false
//str1.length==3 自动转为String对象
str2 instanceof String;//true
//null undefined 没有对应的构造函数 Date只有构造函数没有字面量
//Object Array Function RegExp无论使用字面量还是构造函数,生成的都是对象 Error抛出异常时自动创建
//数组函数也是对象,可以给数组函数添加属性 [1,2,3].name='lisi' fn.name = 'zs'; 数组属性不能是数字,否则会影响数组长度
//深复制: JSON.parse(JSON.stringify(obj))
//浅复制:Object.assign({},obj);相当于 用= 给属性复制
<!doctype html><html lang="en"><head><meta charset="UTF-8"><title>data</title></head><body><script> var mydate = new Date(); // 返回当前时间 console.log(mydate); //返回星期几,用阿拉伯数字表示 console.log(mydate.getDay()) //当前的年份 console.log(mydate.getFullYear()) //设置年份 mydate.setFullYear(88); console.log(mydate); //返回/设置毫秒数 console.log(mydate.getTime()); console.log(mydate.setTime(12345678900000)) console.log(mydate)</script></body></html>