1)数组类型
var arr = [1,2,3];
arr instanceof Array //true
2)对象类型
var obj = {a:10,b:15}
var arr = [1,2,3];
typeof(obj) == 'object' //true
typeof(arr) == 'object' //true
3)遍历对象
var obj = {a:10,b:15}
Object.keys(obj).forEach((key)=>{
console.log(key,obj[key])
})
4)判断对象是否为空
var obj2 = {};
JSON.stringify(obj2) == '{}' //true
5)获取对象的属性名的数组
var obj = {a:10,b:15}
Object.getOwnPropertyNames(obj) //['a','b']
6)判断对象是否含有某属性
var obj = {a:10,b:15}
obj.hasOwnProperty("a") //true