Little function to check if a value is an object:
function isObject(val){
return (
val != null &&
typeof val === 'object' &&
Array.isArray(val) === false
);
}
Notice that Date, RegExp, etc.. will pass the check.
Little function to check if a value is an object:
function isObject(val){
return (
val != null &&
typeof val === 'object' &&
Array.isArray(val) === false
);
}
Notice that Date, RegExp, etc.. will pass the check.
For further actions, you may consider blocking this person and/or reporting abuse
Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.
sharathchandark -
Eda -
Vyacheslav Borodin -
Dhruvang Gajjar -
Top comments (5)
For "plain" object, I rely on
This won't work for class instances:
This is just what "plain" object is.
Or abuse
JSON.stringify
Nice! Haven't seen this approach before :)