how to test if an object is an array in javascript es6 code example
Example 1: if object is array javascript
Array.isArray(object);
Example 2: javascript array contains object
// Works in all browsers
if (array.index(object) !== -1) {
console.log(`my object is in my array`)
}
// ES7 :
if(array.includes(oject)) {
console.log(`my object is in my array`)
}