-2

I want to create an array inside of an object with values that refer to properties of the same object containing the array.

The only problem I am having is that the results inside of the array are undefined instead of what they are supposed to be.

Am I even referring to the properties correctly? Here is my JavaScript for the object.

var cc_cd = {
    name: "CC Waterbound",
    date: "Summer 1995",
    t1name: "Intro",
    t1url: "https://www.youtube.com/embed/Rsh5oQ6JCTI",
    t1length: "0:40",
    t2name: "Bout 2 Go Down",
    t2url: "https://www.youtube.com/embed/XgJ6DdIaXd0",
    t2length: "4:44",
    t3name: "Dope and money",
    t3url: "https://www.youtube.com/embed/cruY77l99_M",
    t3length: "3:51",
    t4name: "Looking Down the Barrel",
    t4url: "https://www.youtube.com/embed/jmLgcnUlgfk",
    t4length: "4:33",
    t5name: "Playa Hatas",
    t5url: "https://www.youtube.com/embed/ZY8eCUuuqJY",
    t5length: "5:18",
    t6name: "4 Real Nigga Possie",
    t6url: "https://www.youtube.com/embed/A-syQCa3iN0",
    t6length: "6:14",
    t7name: "CC Waaterbound",
    t7url: "https://www.youtube.com/embed/eIAOcKg8xfk",
    t7length: "5:25",
    t8name: "Creepin",
    t9url: "https://www.youtube.com/embed/MpBB7rnaw_Q",
    t9length: "3:56",
    t10name: "Hood Cord",
    t10url: "https://www.youtube.com/embed/PNMiP67NhcM",
    t10length: "4:11",
    t11name: "All This Dick",
    t11url: "https://www.youtube.com/embed/a5zWyURBIjE",
    t11length: "5:25",
    array:[this.t1name,this.t1date,this.t1url,this.t2name,this.t2date,this.t2url,this.t3name,this.t3date,this.t3url,this.t4name,this.t4date,this.t4url,this.t5name,this.t5date,this.t5url,this.t6name,this.t6date,this.t6url,this.t7name,this.t7date,this.t7url,this.t8name,this.t8date,this.t8url,this.t9name,this.t9date,this.t9url,this.t10name,this.t10date,this.t10url,this.t11name,this.t11date,this.t11url]
}
Trevor
  • 25
  • 1

1 Answers1

0

I wouldn't know what could be going wrong, but I do know an easy solution could be creating a global array and then setting the property to the global array. Code: var array = [ your array] ; var cc_cd = { List : array, Other properties }; Please mark answered or vote to let me know if this helped!

Calder White
  • 1,287
  • 9
  • 21