1、应用于判断对象中是否有某一个成员
var obj = { name: "lili", age:10, gender:"girl" } console.log("name" in obj); //true
2、遍历对象/数组(for - in)
var arr = [1, "2", null, function name(params) {}] for (var i in arr) { console.log(arr[i]); }
打印结果: