标签:color obj ons for code name var 键值 console
获取对象所有键值
var jsonObject = { "name": "xiaoming", "age": 29 }, keys = []; for(var p in jsonObject){ keys.push(p); } console.log(keys)
var jsonObject1 = { "name": "xiaoming", "age": 29 }; var keys1 = []; for(var p1 in jsonObject1) { if(jsonObject1.hasOwnProperty(p1)) keys1.push(p1); } console.log(keys1); //name age
标签:color obj ons for code name var 键值 console
原文地址:http://www.cnblogs.com/sugerxiaoxiao/p/7613964.html