JavaScript Get Class Name
document.getElementById("myDIV").className = "mystyle";
Envious Emu
document.getElementById("myDIV").className = "mystyle";
myObj.constructor.name
class Language {
getClassName() {
return this.constructor.name;
}
}
const l1 = new Language ();
const objClassName = l1.getClassName();
console.log(objClassName);
const Season = [
{
month:'January',
season: 'Winter',
},
{
month:'March',
season: 'Spring',
},
{
month:'June',
season: 'Summer',
},
{
month:'August',
season: 'Autumn',
},
]
const index = Season.findIndex( (loopVariable) => loopVariable.month === 'March');
console.log("The index of March Month is",index)
class Language {}
const l1 = new Language();
console.log(l1.constructor.name);
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)