Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Unexpected token for "=>" and "object"

I got two "unexpected token" errors (in my editor) for this both lines, but they are working! What’s the fail?

Error 1 (unexpected token ">")

var nameclean = name.replace(/\b(?:ä|ö|ü|ß)\b/gi, matched => umlauts[matched]);

Error 2 (unexpected token "...style1,")

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

var style1 = {color: '#d5913c', weight:"4", fillColor:"#555555", fillOpacity:"0.8"};

var markers = [];
var marker1 = L.circleMarker([000,000],{...style1, alt:"description1"}).addTo(map).on("click", circleClick).bindPopup
    ('<div>Hello</div>').bindTooltip("Hello");
    markers.push(marker1);

>Solution :

I got two "unexpected token" errors (in my editor) for this both lines, but they are working! What’s the fail?

You’re using a syntax checker which either doesn’t support those JavaScript syntax features or is configured to check against an older version of JS.

Arrow functions and spread syntax were introduced in ES6. It looks like your checker is still on ES5.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading