Lets say I have a double album, and I create one object for each side:
var side1 = {};
var side2 = {};
For each song I can create an object with its properties:
song1 = {
side: "side1",
name: "Wicked",
track: 1,
duration: 3.45,
author: "Me",
playing: function(){return "playing" + this.name;},
lyrics: ["politicians", "politician", "politics", "telling",
"lies", "lie", "to",
"media", "the", "youngsters", "young", "elders",
"time",
"that", "passes", "pass", "by", "oh", "no", "lie",
"detector", "detection", "souls", "as", "far",
"illusion",
"goes", "all", "sinners", "sin", "around", "sun",
"earth", "atom", "atoms", "mind", "angels", "angel",
"prophet",
"prophets", "martyr", "knives", "elder", "detect",
"shit", "flies", "fly", "meat", "is",
"knife",
"and", "death", "life", "I", "am", "gonna", "going",
"cast","a", "sacred", "circle"]
};
If I want to loop through the song1, I can create a function:
for(var w in song1.lyrics){
console.log(song1.lyrics[w]);
But how can I use a function like this loop through the arrays
of ALL lyrics? Inheritance
?