"Missing ) after..." 一行,Javascript
"Missing ) after..." on a line, Javascript
所以我在 Javascript 中创建了一个“愚蠢的故事生成器”,在修复了一些弹出的错误后,我遇到了“参数列表后的语法错误:缺失)”
在阅读了更多相关信息后,我了解到当调用函数时出现错误时会发生这种情况。这可能是拼写错误、缺少运算符或未转义的字符串。
我检查了我的代码,我似乎找不到错误,第 38 行的字符串看起来没问题。
谢谢。
randomize.addEventListener('click', result);
function result() {
if (customName.value !== '') {
let name = customName.value;
}
if (document.getElementById("uk").checked) {
let weight = Math.round(300);
let temperature = Math.round(94);
}
story.text = ""
story.style.visbility = 'visible';
var newStory = storyText;
let xItem = randomValueFromArray;
let yItem = randomValueFromArray;
let zItem = randomValueFromArray;
function newStory(buttonPress) {
newStory.contentString.replace("insertX", "insertY", "insertZ")
content.contentString.replace("xItem ", "yItem", "zItem");
}
}
您的代码格式错误。
在newStory.contentString.replace("insertX", "insertY", "insertZ";)
你在括号内有一个分号。
您还缺少靠近末尾的两个大括号。
我建议买一个好的 IDE 或使用您所用的格式化功能。
randomize.addEventListener('click', result);
function result() {
if (customName.value !== '') {
let name = customName.value;
}
if (document.getElementById("uk").checked) {
let weight = Math.round(300);
let temperature = Math.round(94);
}
story.text = ""
story.style.visbility = 'visible';
var newStory = storyText;
let xItem = randomValueFromArray;
let yItem = randomValueFromArray;
let zItem = randomValueFromArray;
function newStory(buttonPress) {
newStory.contentString.replace("insertX", "insertY", "insertZ")
content.contentString.replace("xItem ", "yItem", "zItem");
}
}
你在右括号前写了一个分号
newStory.contentString.replace("insertX", "insertY", "insertZ");
所以我在 Javascript 中创建了一个“愚蠢的故事生成器”,在修复了一些弹出的错误后,我遇到了“参数列表后的语法错误:缺失)”
在阅读了更多相关信息后,我了解到当调用函数时出现错误时会发生这种情况。这可能是拼写错误、缺少运算符或未转义的字符串。
我检查了我的代码,我似乎找不到错误,第 38 行的字符串看起来没问题。 谢谢。
randomize.addEventListener('click', result);
function result() {
if (customName.value !== '') {
let name = customName.value;
}
if (document.getElementById("uk").checked) {
let weight = Math.round(300);
let temperature = Math.round(94);
}
story.text = ""
story.style.visbility = 'visible';
var newStory = storyText;
let xItem = randomValueFromArray;
let yItem = randomValueFromArray;
let zItem = randomValueFromArray;
function newStory(buttonPress) {
newStory.contentString.replace("insertX", "insertY", "insertZ")
content.contentString.replace("xItem ", "yItem", "zItem");
}
}
您的代码格式错误。
在newStory.contentString.replace("insertX", "insertY", "insertZ";)
你在括号内有一个分号。
您还缺少靠近末尾的两个大括号。
我建议买一个好的 IDE 或使用您所用的格式化功能。
randomize.addEventListener('click', result);
function result() {
if (customName.value !== '') {
let name = customName.value;
}
if (document.getElementById("uk").checked) {
let weight = Math.round(300);
let temperature = Math.round(94);
}
story.text = ""
story.style.visbility = 'visible';
var newStory = storyText;
let xItem = randomValueFromArray;
let yItem = randomValueFromArray;
let zItem = randomValueFromArray;
function newStory(buttonPress) {
newStory.contentString.replace("insertX", "insertY", "insertZ")
content.contentString.replace("xItem ", "yItem", "zItem");
}
}
你在右括号前写了一个分号
newStory.contentString.replace("insertX", "insertY", "insertZ");