Download presentation
Presentation is loading. Please wait.
Published bySherman Boyd Modified over 8 years ago
1
Comments Introduction to JavaScript © Copyright 2016, Fred McClurg All Rights Reserved
2
JavaScript Comments What is a comment? Information that is ignored by JavaScript What purpose do comments serve? 1.Provides code documentation for self 2.Provides code documentation for others 3.Improves readability and maintainability 4.Promotes reuse 5.Disabling code (for debugging) 2
3
Inline Comment Single Line Comment: The “ // ” is for commenting a single line. From “ // ” to end of line is ignored. Example: // Single line comment. // Code following slash-slash // to end of line is ignored // Often used after statement var x = 4; // inline comment 3 slashSlash.html
4
Multi-line Comment: Multiple Line (or Block) Comment: /* single line comment */ /* * multiple line * block comment */ 4 slashStar.html
5
Comment Disabling Code Disabling Code: // Disabling parts of code var calendar = { // 'year': 2016, /* 'month': 'Dec', 'day': 25, */ 'holiday': 'Christmas', }; console.log( calendar ); 5 disableCode.html
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.