js动态获取对象的key

2,392 阅读1分钟

const obj = {name:'张三',age:'53',eat:'馒头'};

  1. 使用Object.keys(obj)

2. 使用for in