Comments (2)
example:
const test = () => {
const arr = [1, 2]
console.log("any strings")
[arr[1], arr[2] ] = [arr[2], arr[1]] //error msg pointer to this line
}
const test1 = () => {
const arr = [1, 2]
console.log("any strings"); // comment this line or add a semicolon will works
[arr[1], arr[2] ] = [arr[2], arr[1]] //error msg pointer to this line
}
test() // error
test1() // works
from blog.
出问题的那行的原因 因为是[] 开头, 被结合到了 console的那行
//等同
console.log('any strings')[arr[0], arr[1]] // 逗号表达式 取arr[1]的值
= [arr[1], arr[0]]
因为 console.log() 返回undefined 所以 在undefined[arr[1]] = [arr[1], arr[0]] error
详情 stackoverflow 的提问结果
from blog.
Related Issues (20)
- xcrun: errors
- [img-lazyload]
- [clipboard] web 端 的复制api
- [js] js 中的隐式转换 HOT 5
- [typeScript] interfaces-indexable types HOT 1
- [typeScript] class- modifier HOT 2
- [typeScript] function-this
- [module] require, require().default HOT 1
- [react ] require.resolve() 会解析到packages/ 目录下面 HOT 1
- [redux-sage] channel 用法理解 HOT 2
- [翻译] The Node.js Event Loop, Timers, and process.nextTick() HOT 6
- [css] modal 框展开时 禁止滚动一些奇淫巧技
- [react] Modal 框点击其他区域关闭
- [html] the difference between property and attribute HOT 1
- [serverjs][major, minor, patch]
- [js] defer and async
- [tar] mac tar 压缩文件夹,排除node_modules
- [js] vue 响应式原理
- [typescript]ts这个就够了
- [js]注释图例详解 Redux `applyMiddleware`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blog.