gpt4 book ai didi

Javascript:以前的属性未定义

转载 作者:行者123 更新时间:2023-11-30 13:40:13 26 4
gpt4 key购买 nike

为什么在“creditText”这一行说“lbp is undefined”?如何在这样的配置文件中引用以前的属性?

var lbp = {

// Pertinant page properties, such as Author, Keywords, URL or Title
page: {
theURL: window.location.toString(),
},

// Configurable user defaults
defaults: {
creditText: lbp.page.theURL
}
}

预先感谢您的帮助

最佳答案

你不知道。在对象关闭之前,lbp 不会存在于当前作用域的符号表中。

var lbp = {
// Pertinant page properties, such as Author, Keywords, URL or Title
page: {
theURL: window.location.toString(),
}
}; // NOW you can reference lbp by name

lbp.defaults = {
creditText: lbp.page.theURL
};

关于Javascript:以前的属性未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2717232/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com