📜  object.keys javascript 堆栈溢出 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:48.339000             🧑  作者: Mango

代码示例1
var obj = {
   key1: 'value1',
   key2: 'value2',
   key3: 'value3',
   key4: 'value4'
};
var keys = [];

for (var k in obj) keys.push(k);

alert("total " + keys.length + " keys: " + keys);