분류
javascript
Javascript 30초 Snippet - Type : isObjectLike
본문
값이 객체와 같은지 확인합니다.
https://github.com/30-seconds/30-seconds-of-code
제공된 값이 null이 아니고 typeof가 'object'와 같은지 확인하십시오.
const isObjectLike = val => val !== null && typeof val === 'object';
ex)
isObjectLike({}); // true isObjectLike([1, 2, 3]); // true isObjectLike(x => x); // false isObjectLike(null); // false
- 이전글Javascript 30초 Snippet - Type : isPlainObject 19.11.25
- 다음글Javascript 30초 Snippet - Type : isObject 19.11.25