[英]Javascript Uncaught SyntaxError: Unexpected token {
Here is my FULL code 这是我的完整代码
function onValueChange(res) {
If (res) {
}
else {
}
};
I got error 我有错误
Uncaught SyntaxError: Unexpected token {
on If (res) {
关于If (res) {
What is wrong? 怎么了?
There are 2 updates required in your code 您的代码中需要2个更新
To end function you need to add closing bracket } Also, there is no need for semicolon at the end of function. 要结束函数,您需要添加右括号}此外,函数的末尾也不需要分号。
function onValueChange(res) { if (res) { } else { } }
You can't end functions in javascript like that. 您不能像这样结束javascript中的函数。
Instead of 代替
end function
you have to use 你必须使用
}
And if
has to be lowercase. if
必须是小写的。
Full code: 完整代码:
function onValueChange(res) {
// lowercase if
if (res) {
}
else {
}
}
function onValueChange(res)
{
if (res){
}
else {
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.