Use single quotation marks for strings.
Goodvar name = ' Terence ';//badvar name = "Terence";
Strings longer than 80 characters should be wrapped using a string connector.
Goodvar msg = ' Test Information testing information Test information Test information ' + ' test information Test information Test Information Test Info Testing Information Test information ' + ' test information Test information testing information ';
Badvar msg = ' Test information Test Info test Information Testing Information Test information Test Information Test Info Testing Information Test information Test information Test information Test information Test information Testing Information Test info test information ';
Strings created with the program should use the join method of the array to concatenate strings instead of using connectors.
</pre><pre name= "Code" class= "javascript" >var items = []; var msgs;var length;var i; msgs = [{no: ' 1 ', msg: ' One ' },{no: ' 2 ', msg: ' Both '}]function Inbox (msgs) {//good for (i=0;i<length;i++) { items[i] = ' <li> ' +msgs[i]} Return Items.join (") + ' </ul> ';//badreturn items + ' </ul> '}
"Learning Notes" JavaScript coding specification-strings