javascript is object
let myObject = {
firstname: 'harry',
lastname: 'potter'
}
//check the typeof if, boolean, object, string etc...
console.log(typeof myObject);
if(typeof myObject === 'object') {
console.log('this is object');
}//checks if is object, null val returns false
function isObject(val) {
if (val === null) { return false;}
return ( (typeof val === 'function') || (typeof val === 'object') );
}
var person = {"name":"Boby Snark"};
isObject(person);//truetypeof yourVariable === 'object' && yourVariable !== null
Also in JavaScript:
- How to append to a file in Node?
- clearing cookie in js
- angular [routerlink]
- firebase cloud functions send email
- how to set disabled flag formgroup angular
- convert boolean to string javascript
- variables 2 python .Bartolome sintes Marco
- drupal 7 db delete node programmatically based on condition
- Exception in thread "main" org.openqa.selenium.JavascriptException: cannot read getPlayerState
- react router 404 redirect
- uppy init
- como saber cuando un link cambia angular
- html initialize select
- datatables clear table
- javascript const
- what is react mounting
- javascript canvas clip rectangle
- jquery select by data attribute
- angular for each
- vuejs show content on loaded
- jquery redirect
- how to verify timestamp format in javascript
- reduce method javascript
- jquery onclick function