标签: javascript
var str = 'foobar'; console.log( str[4] ); prints: a
这证明字符串也像数组一样。我是否正确?
答案 0 :(得分:3)
您不能在特定索引处设置字符,所以不,不是真的:
> var a = 'foo'; undefined > a[0] = 'x'; // No warning, no error. It just silently fails. "x" > a "foo"