If I create a class SONG()
, and define many properties, how can i create a method that will use an argument passed through and get that property?
function SONG(i) {
/* properties */
this.title = results.title[i];
this.artist = results.artist[i];
this.album = results.album[i];
this.info = results.info[i];
/* methods */
this.getstuff = function(stuff){
console.log(this.stuff); // doesn't work
}
}
var song1 = new SONG(1);
song1.getstuff(title);
// how can I have this dynamically 'get' the property passed through as an argument?
any help or advice is greatly appreciated!