"Holes" in array when use es6 spread operator on string with emojis "Holes" in array when use es6 spread operator on string with emojis google-chrome google-chrome

"Holes" in array when use es6 spread operator on string with emojis


Certainly this is a bug.

As a workaround, Array.from() works identically except it isn't buggy.

> s="\uD83C\uDF1F\u5FCD\u8005\u306E\u653B\u6483\uD83C\uDF1F"> [...s](9) ["🌟", "忍", "者", "の", "攻", "撃", "🌟", hole, hole]> Array.from(s)(7) ["🌟", "忍", "者", "の", "攻", "撃", "🌟"]

It looks like the fix is in Chrome 72, but you could open a bug in Chromium and ask for it to be merged to 71.

The fix and test case are here: https://crrev.com/902d21dd661033427b56d5f93c12b12339bf55ab

(I believe "hole" is V8 telling you that some native code screwed up and failed to initialize the array properly, in contrast to "empty" which can be produced by ordinary javascript.)

Yep, V8 has definitely confused itself:

> a=[...'\u{1f4a9}'](2) ["💩", hole]> hole=a[1]undefined> holeVM384:1 Uncaught ReferenceError: hole is not defined


it's oK now

[...'💪']// ["💪"][...'💪💪']// (2) ["💪", "💪"]