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
Andrew Bell -
Seyed Ahmad -
thinkThroo -
Rohit Khokhar -
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 :)