Last active
February 6, 2016 20:58
-
-
Save samueleaton/049e196db755ae542c2b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // es5 | |
| function isArray(obj) { | |
| if(typeof obj === 'object' && ((Array.isArray && Array.isArray(obj)) || | |
| obj.constructor === Array || | |
| obj instanceof Array)) { | |
| return true; | |
| } | |
| return false; | |
| } | |
| // es2015 | |
| const isArray = obj => typeof obj === 'object' && ((Array.isArray && Array.isArray(obj)) || obj.constructor === Array || obj instanceof Array); |
Author
samueleaton
commented
Dec 9, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment