对象JavaScript中的数组
我想在对象内部创建一个数组,其值引用包含该数组的同一对象的属性 我唯一的问题是数组中的结果是未定义的,而不是它们应该是什么 我是否正确地引用了这些属性?这是我的对象JavaScript对象JavaScript中的数组,javascript,arrays,Javascript,Arrays,我想在对象内部创建一个数组,其值引用包含该数组的同一对象的属性 我唯一的问题是数组中的结果是未定义的,而不是它们应该是什么 我是否正确地引用了这些属性?这是我的对象JavaScript var cc_cd = { name: "CC Waterbound", date: "Summer 1995", t1name: "Intro", t1url: "https://www.youtube.com/embed/Rsh5oQ6JCTI", t1length:
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]
}
我不知道会出什么问题,但我知道一个简单的解决方案是创建一个全局数组,然后将属性设置为全局数组。 代码:
var数组=[您的数组];
变量cc_cd={
列表:数组,
其他属性
};
请标记答案或投票让我知道这是否有帮助