JSFiddle - React, Tailwind, and code Playground
by Hari Menon
JavaScript
function SONG(i) {
/* properties */
this.title = "My Title";
this.artist = "My Artist";
/* methods */
this.getstuff = function(stuff){
if (this.hasOwnProperty(stuff))
return this[stuff];
else
return null;
}
}
var song1 = new SONG(1);
console.log(song1.getstuff("title"));
console.log(song1.getstuff("invalid"));