💾isObject()
check if value is an object
JS ⟩ values ⟩ custom functions ⟩ isObject()
replit:isPrimitive()
// ⭐ check if value is object
function isObject(value) {
return value === Object(value)
}
// ⭐ check if value is primitive
function isPrimitive(value) {
return !isObject(value)
}
// export
module.exports = { isObject, isPrimitive };
Last updated
Was this helpful?