I'm trying to follow the JS code style defined by Airbnb.
The rule on trailing commas for function call arguments states:
7.15 Functions with multiline signatures, or invocations, should be indented just like every other multiline list in this guide: with each item on a line by itself, with a trailing comma on the last item.
But when I do the following:
/* THREE.js constructor for PerspectiveCamera */
const camera = new THREE.PerspectiveCamera(
75,
window.innerWidth / window.innerHeight,
0.1,
1000,
);
Google Chrome complains with the following error:
app.js:11 Uncaught SyntaxError: Unexpected token )
When I remove the trailing comma everything works fine. This code works fine in Firefox and I am fairly sure it worked a week ago from today (11.04.2017) in Chrome as well - because I haven't changed my code since than and I was presenting the app I'm working on to my colleague.
Note that trailing comma in arrays still works fine:
testArray = [
'one',
'two',
'three',
];
Can someone explain this behavior or point me to where I can look for more information?
Using Google Chrome (Version 57.0.2987.133 (64-bit)) on Ubuntu 16.04.