Single quote strings keeps code consistent and productive
bad:
“it is a bad string”
“it is a \”bad\” string”
good:
“it ‘ s a good string”
var JSONObject=’ {
“name”:”John Johnson”,
“street”:”Oslo West 555″,
“age”:33,
“phone”:”555 1234567″}’;
Â
Why you should care
An exception should be noted that double-quotes (“) are used to writing JSON as it’s libraries do not support single-quotes (‘). This is helpful when creating strings that include HTML or to generate JSON.
Business Impacts
Keeping consistent during development is important because preventing possible bugs and miscommunication between the team helps the code in being resilient which maximizes its’ productivity.
CAST recommendations
CAST recommends keeping your code consistent because that engenders healthy programming and more collaborative development which is reflective of how programming has changed in the more recent years as its taken a more Agile-based approach. Inconsistent code has the opposite effect and ill-advised, hence keeping single quotes can be one of the many steps towards ensuring your code is productive.
References
https://stackoverflow.com/questions/242813/when-to-use-double-or-single-quotes-in-javascript
http://www.agile-process.org/
About CAST and Highlight’s Code Insights
Over the last 25 years, CAST has leveraged unique knowledge on software quality measurement by analyzing thousands of applications and billions of lines of code. Based on this experience and community standards on programming best practices, Highlight implements hundreds of code insights across 15+ technologies to calculate health factors of a software.