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 关键字赋值。


相关文章
|
3月前
|
CDN
Iconfont——Error: <path> attribute d: Expected number, "MNaNNaNaNaNNaNNaN…".
Iconfont——Error: <path> attribute d: Expected number, "MNaNNaNaNaNNaNNaN…".
36 0
|
6月前
Uncaught TypeError: Cannot use ‘in‘ operator to search for ‘path‘ in undefined
Uncaught TypeError: Cannot use ‘in‘ operator to search for ‘path‘ in undefined
|
6月前
|
人工智能
L - MaratonIME doesn't like odd numbers
L - MaratonIME doesn't like odd numbers
|
12月前
ReferenceError: document is not defined
ReferenceError: document is not defined
50 0
ReferenceError: self is not defined
ReferenceError: self is not defined
496 0
|
JavaScript
成功解决:Uncaught TypeError: Cannot read property 'search' of undefined
成功解决:Uncaught TypeError: Cannot read property 'search' of undefined
|
Dart 前端开发 JavaScript
Syntax Error: TypeError: this.getOptions is not a function
Syntax Error: TypeError: this.getOptions is not a function
526 0
Syntax Error: TypeError: this.getOptions is not a function
|
前端开发
Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation 问题
Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation 问题
Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation 问题
error: implicit declaration of function ‘RAND_egd’ [-Werror=implicit-function-declaration]
error: implicit declaration of function ‘RAND_egd’ [-Werror=implicit-function-declaration]
127 0