我对JS的理解不够好或根本不了解,我需要对其进行调试。如果我将粘贴代码复制到Google中,我什么也不会得到。我对大多数项目都做得很好,但后来他们抛出了。我希望这不是我烦恼的迹象……这太浪费了钱。我很穷。
Google,我的教科书
$("#factButton").on("click", function() {
var number = Math.floor((Math.random() * booFacts.length));
$("#factText").text(booFacts[number])
})
var booFacts = ["Boo is a pomeranian, Boo's best friend is another
pomeranian named Buddy, Boo the Pomeranian was born on March 16, making
him a Pisces, Boo's favourite food is grass, Boo has released two books"
};
$("#textPink").on("click", function() {
$("#funText").css("color", pink)
})
$("#textOrange").on("click", function() {
$("#funText").css("color", "orange")
})
$("#textGreen").on("click", function() {
$("#funText").css("color: "green")
})
$("#boxGrow").on(click, function() {
$("#box").animate({height:"+=35px",
width:"+=35px"}, "fast");
})
$("#boxShrink").on(click, function() {
$("#box").animate({height:"-=35px", width:"-=35px"}, "fast");
})
C:\Program Files\nodejs\node.exe --inspect-brk=7514 logic.js
Debugger listening on ws://127.0.0.1:7514/526fd8e0-d4b7-4d23-b81d-
62b99e284ae8
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
c:\Users\richa\Desktop\BrokenCode\logic.js:16
$("#funText").css("color: "green")
^^^^^^^^^
SyntaxError: missing ) after argument list
at Module._compile (internal/modules/cjs/loader.js:721:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
Waiting for the debugger to disconnect...
SyntaxError: missing ) after argument list
at Module._compile (internal/modules/cjs/loader.js:721:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
答案 0 :(得分:0)
$("#funText").css("color: "green")
^^^^^^^^^
SyntaxError: missing ) after argument list
它向您显示错误在哪里。这是一个错字。
您有可行的示例
$("#funText").css("color", "orange")
坏了突出显示
$("#funText").css("color: "green")
您能找到区别吗?