File tree Expand file tree Collapse file tree 1 file changed +20
-19
lines changed Expand file tree Collapse file tree 1 file changed +20
-19
lines changed Original file line number Diff line number Diff line change 7070
7171## < a name= ' objects' > Objects< / a>
7272
73- - Use the literal syntax for object creation
73+ - Use the literal syntax for object creation.
7474
7575 ` ` ` javascript
7676 // bad
161161 var fullName = "Bob #{lastName}";
162162 ` ` `
163163
164- - String longer than 80 characters should be written across Multiple lines using string concatenation.
164+ - Strings longer than 80 characters should be written across multiple lines using string concatenation.
165165
166166 ` ` ` javascript
167167 // bad
214214 }
215215
216216 return items + '</ul>';
217- };
217+ }
218218
219219 // good
220220 function inbox(messages) {
225225 }
226226
227227 return '<ul>' + items.join('') + '</ul>';
228- };
228+ }
229229 ` ` `
230230
231231 ** [[⬆]](#TOC )**
413413 }
414414
415415 return name;
416- };
416+ }
417417
418418 // good
419419 function () {
429429 }
430430
431431 return name;
432- };
432+ }
433433
434434 // bad
435435 function () {
637637 // ...stuff...
638638
639639 return element;
640- };
640+ }
641641
642642 // good
643643 /**
652652 // ...stuff...
653653
654654 return element;
655- };
655+ }
656656 ` ` `
657657
658658 - Use ` // ` for single line comments. Place single line comments on a newline above the subject of the comment. Put an emptyline before the comment.
672672 var type = this._type || 'no type';i
673673
674674 return type;
675- };
675+ }
676676
677677 // good
678678 function getType() {
682682 var type = this._type || 'no type';
683683
684684 return type;
685- };
685+ }
686686 ` ` `
687687
688688 ** [[⬆]](#TOC )**
696696 // bad
697697 function() {
698698 ∙∙∙∙var name;
699- };
699+ }
700700
701701 // bad
702702 function() {
706706 // good
707707 function() {
708708 ∙∙var name;
709- };
709+ }
710710 ` ` `
711711 - Place 1 space before the leading brace.
712712
713713 ` ` ` javascript
714714 // bad
715715 function test(){
716716 console.log('test');
717- };
717+ }
718718
719719 // good
720720 function test() {
721721 console.log('test');
722- };
722+ }
723723
724724 // bad
725725 dog.set('attr',{
911911 // bad
912912 function user(options){
913913 this.name = options.name;
914- };
914+ }
915915
916916 var bad = new user({
917917 name: 'nope'
920920 // good
921921 function User(options){
922922 this.name = options.name;
923- };
923+ }
924924
925925 var good = new User({
926926 name: 'yup'
992992 options || (options = {});
993993 var lightsaber = options.lightsaber || ' blue' ;
994994 this.set(' lightsaber' , lightsaber);
995- };
995+ }
996996
997997 Jedi.prototype = {
998998 set: function(key, val) {
10151015 ```javascript
10161016 function Jedi() {
10171017 console.log(' new jedi ' );
1018- };
1018+ }
10191019
10201020 // bad
10211021 Jedi.prototype.fight = function fight() {
10831083 function Jedi(options) {
10841084 options || (options = {});
10851085 this.name = options.name || 'no name';
1086- };
1086+ }
10871087
10881088 Jedi.prototype = {
10891089 getName: function getName() {
@@ -1293,3 +1293,4 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12931293** [[⬆]](#TOC )**
12941294
12951295# };
1296+
You can’t perform that action at this time.
0 commit comments