Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript is array or object

const data = [1,2,3,4,5];const isArray = Object.prototype.toString.call(data) === '[object Array]';console.log(isArray); // trueconst data = {id: 1, name: “Josh”};const isArray = Object.prototype.toString.call(data) === '[object Array]';console.log(isArray); // false
Source by amandeepkochhar.medium.com #
 
PREVIOUS NEXT
Tagged: #javascript #array #object
ADD COMMENT
Topic
Name
9+1 =