Duplicate property names in object literals

This is a Sonar rule that makes sure the JSON structure has quality built-in.

Sample JSON:

var data = {
    "key": "value",
    "key": "value2", // not compliant
    key: "value3" // not compliant
}

In this case, data.key will be “value3” (taking the last instance).

JavaScript allows you to do this, it is valid javascript, but it only takes the last instance. This makes the code hard to debug and prone to bugs since a developer unfamiliar with the nls file or whatnot will assume the first Ctrl-F found item is the only instance.

 
13
Kudos
 
13
Kudos

Now read this

Using URL.createObjectURL()

This is a blog post about using the Web API URL.createObjectURL(). Here we will go through the use cases as well as the inner intricacies of what this Web API does. First up lets see how to use the API. URL.createObjectURL() # Syntax... Continue →