ganqqwerty / 123-Essential-JavaScript-Interview-Questions

JavaScript interview Questions
BSD 3-Clause "New" or "Revised" License
5.01k stars 1.18k forks source link

Another type of method to check if an object is an array or not #53

Closed partha0103 closed 6 years ago

ganqqwerty commented 6 years ago

well, it's the same method actually: duck typing... it has the same pros and cons. I don't see any reason to include it to the book actually.

partha0103 commented 6 years ago

I found that this method is not suitable to check if an array is a object or not as an object can have a length property also.

{ length: 7 }

ganqqwerty commented 6 years ago

Yeah, that's my point. So, abandoning the request.