let names=['Jhon','David','Mark'];console.log(Array.isArray(names));// truelet user={id:1,name:'David'};console.log(Array.isArray(user));// falselet age 18;console.log(Array.isArray(age));// false
let fruit ='apple';let fruits =["apple","banana","mango","orange","grapes"];constisArray=(arr)=>Array.isArray(arr);console.log(isArray.(fruit));//output - falseconsole.log(isArray.(fruits));//output- true
// all following calls return trueArray.isArray([]);Array.isArray([1]);Array.isArray(newArray());Array.isArray(newArray('a','b','c','d'));Array.isArray(newArray(3));// Little known fact: Array.prototype itself is an array:Array.isArray(Array.prototype);// all following calls return falseArray.isArray();Array.isArray({});Array.isArray(null);Array.isArray(undefined);Array.isArray(17);Array.isArray('Array');Array.isArray(true);Array.isArray(false);Array.isArray(newUint8Array(32));Array.isArray({__proto__:Array.prototype});
// I know javascript can be hard but see this example and you will learn// Javascript if condition and array examplevar people =["filex","alex","jon"];var peopleNeeded = people[1];// 1 is the index bc the index starts from 0if(peopleNeeded <= people[1]){console.log("alex needed");}else{console.log("lol");}