File tree Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -14,10 +14,10 @@ descr: >
1414 - [node.js](https://nodejs.org/en/)
1515code :
1616 - |
17- # a simple calculation
17+ // a simple calculation
1818 1+1
1919 - |
20- # the version of Node.js
20+ // the version of Node.js
2121 process.version
2222 ---
2323title : Variables
@@ -26,11 +26,11 @@ descr: >
2626 `let` tells JavaScript, that this is a new variable.
2727code :
2828 - |
29- # define x
29+ // define x
3030 let x = 20
3131 x
3232 - |
33- # now refer to x in a calculation
33+ // now refer to x in a calculation
3434 2 * x + 1
3535 ---
3636title : Print output
@@ -81,12 +81,25 @@ descr: >
8181code :
8282 - |
8383 function f1(x) {
84- return 2*x+ 1;
84+ return 2 * x + 1;
8585 }
8686 - |
8787 function bar(func, arg) {
88- let y = 2 * func(arg) * 1
88+ let y = 1 + func(arg) + func(arg + 1)
8989 return y;
9090 }
9191 - |
9292 bar(f1, 3)
93+ ---
94+ category : Tutorial / Iterations
95+ ---
96+ title : for-loop
97+ descr : >
98+ A for-loop iterates a value over a block of code.
99+ code :
100+ - |
101+ let sum = 0;
102+ for (let i = 0; i < 10; i++) {
103+ sum += i;
104+ }
105+ sum;
You can’t perform that action at this time.
0 commit comments