trailing commas
Trailing comma
trailing comma javascript
Trailing commas (sometimes called "final commas") can be useful when adding
new elements, parameters, or properties to JavaScript code.
If you want to add a new property, you can simply add a new line without
modifying the previously last line if that line already uses a trailing comma.
This makes version-control diffs cleaner and editing code might be less
troublesome.
//For arrays
var arr = [
1,
2,
3,
];
arr; // [1, 2, 3]
arr.length; // 3
//For objects
var object = {
foo: "bar",
baz: "qwerty",
age: 42,
};
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us