Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

How to get the Class Name of an Object in JavaScript

const Season = [
  {
    month:'January',
    season: 'Winter',
  },
  {
    month:'March',
    season: 'Spring',
  },
  {
    month:'June',
    season: 'Summer',
  },
  {
    month:'August',
    season: 'Autumn',
  },
]

const index = Season.map( (loopVariable) => loopVariable.month).indexOf
 ("March"));
console.log("The index of March Month is",index)
Source by itsjavascript.com #
 
PREVIOUS NEXT
Tagged: #How #Class #Name #Object #JavaScript
ADD COMMENT
Topic
Name
7+3 =