Created
March 1, 2017 04:26
-
-
Save marksiemers/731b9b5d759725357e57522fc9958725 to your computer and use it in GitHub Desktop.
Function to check if objects are arrays
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
function isArray(obj) { | |
return (typeof obj !== "undefined" | |
&& obj !== null | |
&& obj.constructor === Array) | |
} | |
function areArrays() { | |
if (arguments.length === 0){ return null } | |
for (i = 0; i < arguments.length; i++) { | |
if (!isArray(arguments[i])) { return false } | |
} | |
return true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment