-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[js] 第902天 请解释下[1,2,3,4,5].indexOf('3')
的结果
#4533
Labels
js
JavaScript
Comments
|
-1 因为数组里面是数字你找的是字符串 而且比较===比较 不是 == 不会隐式转换 |
结果为 -1,因为indexOf函数的比较为 === ,需要值,类型都相等 |
-1 |
-1 因为数组里没有字符串, indexOf 要找的是字符串,找不到就返回-1 |
字符串模板不会计算,所以还是展示原来的内容[1,2,3,4,5].indexOf('3') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
第902天 请解释下
[1,2,3,4,5].indexOf('3')
的结果3+1官网
我也要出题
The text was updated successfully, but these errors were encountered: