Reputation: 827
This simple javascript arrow function results in a parser error. The syntax seems consistent with all the examples I've seen. What is the syntax error and how do I correct it?
var things = [];
things.push("a");
var containsA = things.some(t => t === "a");
The error: Uncaught SyntaxError: missing ) after argument list
Upvotes: 0
Views: 2572
Reputation: 13344
Currently Arrow Functions
are supported by FireFox
only.
From MDN:
Upvotes: 1
Reputation: 288520
Your code produces a valid arrow function:
t => t === "a"
However, arrow functions are an experimental technology, part of the ECMAScript 6 proposal, which currently is still a draft. Therefore, not all browsers have implemented them yet.
Among the major ones, only Firefox has. If you attempt to use them on Chrome, you will get an error.
Upvotes: 1