一个javascript有关json的小问题(我可能用了假编译器)
一口快乐水 2017-01-23 08:27:54 example1:
```
json={
//字符串str
str:"+12345"
}
alert(typeof(str))
if(!json.str.indexOf("+")==-1)
{
alert("yes")
}
```
这个会输出什么呢?我猜会是json.str.indexOf("+") is not a function
example2:
```
json={str:"+123"}
alert(typeof(str))
alert(json.str.indexOf("+"))
```
输出会是什么呢?我猜是0
example3
```
json={str:
{indexOf:function(s){}
}
}
alert(json.str.indexOf("+"))
```
输出会是什么呢?
求大神亲测解释原理
我是不是用了假的编译器??