Object.prototype.toString.call(val) == '[object Array]' ? val.some(e => e != undefined && e != null && e != '') : false;
val is the array after the splice(0, 1) operation. I want val.some to return in the situation shown below. false
val
splice(0, 1)
val.some
in the situation shown below. false
Array.prototype.some will skip elements with value undefined
Array.prototype.some
If you need to consider undefined, you need to write a for loop to traverse it.
If indeed some, the callback method will not be executed.
Array.prototype.some
will skip elements with value undefinedIf you need to consider undefined, you need to write a for loop to traverse it.
If indeed some, the callback method will not be executed.