Skip to content

Commit 9938d89

Browse files
committed
converted 'syntax basics' code to the right convention'
1 parent 6ed6166 commit 9938d89

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

page/javascript-101/syntax-basics.md

+12-8
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ github: jquery
88

99
JavaScript has support for single and multi line comments. Comments are ignored by the JavaScript engine, therefore have no side-effects on the outcome of the program. They should be used to document the code for future developers (including yourself!). There are libraries available that can generate project documentation pages based on commenting conventions used, [JSDoc](http://code.google.com/p/jsdoc-toolkit/, "JSDoc Toolkit") is one of the more popular ones.
1010

11-
<javascript caption="Single and multi line comments.">
11+
``` js
12+
// Single and multi line comments.
1213
// this is an example of a single line comment.
1314

1415
/*
@@ -17,18 +18,20 @@ JavaScript has support for single and multi line comments. Comments are ignored
1718
* multi line
1819
* comment.
1920
*/
20-
</javascript>
21+
```
2122

2223
### Whitespace
2324

2425
Whitespace is also ignored in JavaScript. There are many tools that will actully strip out all the whitespace in a program reducing the overall file size in order to improve network latency. Given the availability of tools like these, whitespace should be leveraged to make the code as readible as possible.
2526

26-
<javascript caption="Whitespace is insignifigant.">
27+
``` js
28+
// Whitespace is insignifigant.
2729
var hello = "Hello";
2830
var world = "World!";
29-
</javascript>
31+
```
3032

31-
<javascript caption="Semantic whitespace promotes readibility.">
33+
``` js
34+
// Semantic whitespace promotes readibility.">
3235
// readible code is good!
3336
var foo = function() {
3437
for (var i = 0; i < 10; i++) {
@@ -40,7 +43,7 @@ foo();
4043

4144
// not so much!
4245
var foo=function(){for(var i=0;i<10;++){alert(i);}};foo();
43-
</javascript>
46+
```
4447

4548
### Reserved Words
4649

@@ -56,13 +59,14 @@ Identifiers are used to name variables and functions with a unique name so they
5659

5760
It is best practice to name these identifiers to something that will make sense to other developers and to you later on.
5861

59-
<javascript caption="Valid identifier names.">
62+
``` js
63+
// Valid identifier names.
6064
var myAwesomeVariable = 'a';
6165
var myAwesomeVariable2 = 'b';
6266
var my_awesome_variable = 'c';
6367
var $my_AwesomeVariable = 'd';
6468
var _my_awesome_variable_$ = 'e';
65-
</javascript>
69+
```
6670

6771
While it is possible to run JavaScript in server-side environments, that is out of the scope for this section.
6872

0 commit comments

Comments
 (0)