具有非常特殊字符的字符串会导致问题

string with very special characters causes problemes

我有一个字符串

</code></p> <p>我想从此字符串中获取第二个字符</p> <pre><code>// with a normal string the result is var normalString = "abc" normalString[1] // -> b

// but with this one the reslt is 
var weirdString = ""
weirdString[1] // -> � I get this "replacement charactere" instead of 

1) 这里可以使用spread syntax将字符串展开成数组

const weirdStringArr = [...weirdString];

2) 使用索引

访问UNICODE符号
weirdStringArr[1]

var weirdString = "";
const weirdStringArr = [...weirdString];
console.log(weirdStringArr[1]);