The meaning of {}, +{}, [], +[] in javascript
阿神
阿神 2017-05-19 10:40:20
0
1
598
function test(){
    return (+{}+[])[1]; //返回a
}

It’s like the above js code. What I want to know is why the return value is "a"?

阿神
阿神

闭关修行中......

reply all(1)
阿神

+{}=NaN,NaN+[]="NaN","NaN"[1]=a

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!