To do this in any ES5-compatible environment, such as Node, Chrome, IE 9+, Firefox 4+, or Safari 5+:

Object.keys(obj).length

1 답변

0 투표
var obj = { name: '나눔팁', homepage: 'https://www.nanumtip.com/' };
var count = Object.keys(obj).length;
console.log('object key 개수', count);

add
...