check if a variable is array in javascript
if(Array.isArray(myVarToTest)) {
// myVatToTest is an array
} else {
// myVarToTest is not an array
}// inside if else check
if(Array.isArray(myVarToTest)) {
// myVatToTest is an array
} else {
// myVarToTest is not an array
}var colors=["red","green","blue"];
if(Array.isArray(colors)){
//colors is an array
}
Also in JavaScript:
- mv multiple directories
- array concat in javascript
- bash expression
- passing data in react router history,push
- select parent of elemt
- javascript button
- json parsing techniques in api
- set value of input javascript
- react border radius
- copyq script export tab to json
- javascript location redirect target _blank
- Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?
- can we add jquery in chrome extension js code
- PayloadTooLargeError: request entity too large
- How to install react native hooks with npm
- react time picker
- set localstorage
- Uncaught (in promise) SyntaxError: Unexpected token O in JSON at position 0
- event module in node js
- anagram program in javascript
- js get meta-tag name
- glitch node version
- jquery select by name attribute
- splice method js