JavaScript determines whether the variable is empty null,undefined, an empty array, an empty object, an empty objects, whether the string is empty or consists entirely of whitespace characters, whether the number is 0, and whether the Boolean is false. Because object has no length
Object.keys () applies to arrays, which return an array of enumerable instance property names to determine whether it is empty.
Using logic to judge the OR (| | As long as there is one item that is true, the next expression is no longer evaluated, regardless of the type of parameter passed in. Returns true as long as the definition of my null is met.
1 function IsNothing (e) {2 var false Null | | E = = Undefined | | Object.keys (e). length = = 0 | | /^\s*$/gim.test (e.tostring ()); 3 return isnt; 4 }
JavaScript determines whether variables are empty null,undefined, empty arrays, empty objects (empty object), whether the string is empty or consists entirely of whitespace characters, whether the number is 0, and whether the Boolean is false.