자바스크립트 객체(Object)가 비어있는지 확인하는 방법은 다양합니다. Object.keys 사용하기: const myObject = {}; if (Object.keys(myObject).length === 0) { console.log('The object is empty.'); } else { console.log('The object is not empty.'); } Object.getOwnPropertyNames 사용하기: const myObject = {}; if (Object.getOwnPropertyNames(myObject).length === 0) { console.log('The object is empty.'); } else { console.log('The object is not..
자바스크립트 객체(Object)가 비어있는지 확인
자바스크립트 객체(Object)가 비어있는지 확인하는 방법은 다양합니다. Object.keys 사용하기: const myObject = {}; if (Object.keys(myObject).length === 0) { console.log('The object is empty.'); } else { console.log('The object is not empty.'); } Object.getOwnPropertyNames 사용하기: const myObject = {}; if (Object.getOwnPropertyNames(myObject).length === 0) { console.log('The object is empty.'); } else { console.log('The object is not..
2023.09.01