When I work with object literals in JavaScript, I often encounter syntax errors when adding a new label / value pair without including the trailing comma. This can be frustrating as it's easy to forget to include the necessary delimiter.
.draggable({
containment: "parent",
opacity: 0.50 // <- missing comma
revert: true // new pair
});
To simplify this process and avoid mistakes, I've started using a dummy pair at the end of my objects. By doing so, all newly added pairs automatically have the required trailing comma. I'm curious if there are other conventions for addressing this issue. Is using an empty double quote pair smart or silly? Any suggestions would be appreciated. Thank you!
.draggable({
containment: "parent",
opacity: 0.50,
"": null // dummy pair
});