Uncaught ReferenceError: Invalid left-hand side in assignment

简介: Uncaught ReferenceError: Invalid left-hand side in assignment

js的报错有时候会让人很难以琢磨


尝试给不能赋值的东西赋值,引起这个错误

if(doSomething() = 'somevalue')

此例中,程序员意外地使用了单个等号,而不是双等号。“left-hand side in assignment” 提及了等号左手边的部分,因此你可以看到以上例子,左手边包含不能赋值的东西,导致这个错误。


如何修复错误:确保没有给函数结果赋值,或者给 this 关键字赋值。


相关文章
|
4天前
|
人工智能
L - MaratonIME doesn't like odd numbers
L - MaratonIME doesn't like odd numbers
|
Dart 前端开发 JavaScript
Syntax Error: TypeError: this.getOptions is not a function
Syntax Error: TypeError: this.getOptions is not a function
461 0
Syntax Error: TypeError: this.getOptions is not a function
syntax error, expect {, actual [, pos 0 at
syntax error, expect {, actual [, pos 0 at
131 0
error: implicit declaration of function ‘RAND_egd’ [-Werror=implicit-function-declaration]
error: implicit declaration of function ‘RAND_egd’ [-Werror=implicit-function-declaration]
98 0
|
C语言
error: implicit declaration of function ‘VerifyFixClassname‘ is invalid in C99 [-Werror,-Wimplicit-f
error: implicit declaration of function ‘VerifyFixClassname‘ is invalid in C99 [-Werror,-Wimplicit-f
120 0
error: implicit declaration of function ‘read‘ [-Werror,-Wimplicit-function-declaration]
error: implicit declaration of function ‘read‘ [-Werror,-Wimplicit-function-declaration]
182 0
TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'
TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'
357 0
TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'
TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'
177 0
|
Web App开发 JavaScript 前端开发
Uncaught SyntaxError - unexpected end of input
Created by Jerry Wang, last modified on Sep 15, 2014
164 0
Uncaught SyntaxError - unexpected end of input