Unexpected symbol with spread operator


Hello everyone, I have recently discovered this tool and I would like to use it to add executable js code samples to my blog. Like this : https://codeburst.io/javascript-es6-the-spread-syntax-f5c35525f754. As I’m writing about the spread operator I tried the following example, however, I get an error saying '‘Unexepected symbol on line : x, y’.

If I rewrite the example from the runkit tool inside the page, I notice that the error doesn’t appear anymore. It seems like the dots on the first load of the page are not correct, in fact they take half of the space of the dots entered manually to try the examples. Maybe some problems with Wordpress ??

here is the example :

var arr = [2, 4, 8, 6, 0]; var max = Math.max(...arr);



It could be possible that you’ve somehow inserted the horizontal ellipses character (…) instead of simply three periods (…).

edit: In fact you can see here that my triple periods were turned into the unicode horizontal ellipses.


Hi pd-andy,

We’re really sorry about this. The problem is that babel 6 does not seem to properly support the spread operator, and the bug fix was added to the babel 7 branch, which is just now reaching RC. Since all the code has to pass through babel regardless of node version, this very annoyingly means spread doesn’t work properly even in node versions that support it natively. I will take a look this weekend to see if in the last couple of months this fix was backported to babel 6 and we can maybe get this fixed before Babel 7 ships.

Thanks and sorry again,