Updated Introduction to Editor Scripting.md (markdown)
commited
commit
2a9ae20a43ac5f982a64f18a77f905eb1a1497ac
... | ... | @@ -46,7 +46,7 @@ findBlock("My Block"); |
46 | 46 | ``` |
47 | 47 | You can once again see a function, but this one is called `findBlock`. In contrast to the previous function, this one doesn't take numbers as input. Instead it takes a block of text, called a string, which is encapsulated by a pair of quotes. We can now run this code, but it will do nothing at first, because we haven't used the output of the function anywhere. We can change this by storing the output in a variable! |
48 | 48 | |
49 | ## [๐](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types/#declarations)Variables |
|
49 | ## [๐](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types/#Declarations)Variables |
|
50 | 50 | ```js |
51 | 51 | // Find block by name and store it in a variable |
52 | 52 | let myBlock = findBlock("My Block"); |
... | ... | @@ -96,9 +96,9 @@ for (let index of myBlocks) { |
96 | 96 | ``` |
97 | 97 | This time, the line starts with a `for` loop expression. Inside this expression, we create a variable `index` and assign it to each index in the array. The code inside the curly braces will then be repeated for each new index. This is similar to using a [[Loop]] block with the array length as input. |
98 | 98 | |
99 | Take note that there are also other kinds of loop iterators. In our example we have used the [for...of](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Loops_and_iteration/#for...of_statement) loop. |
|
99 | Take note that there are also other kinds of loop iterators. In our example we have used the [for...of](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Loops_and_iteration/#For...of_statement) loop. |
|
100 | 100 | |
101 | ## [๐](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures/#objects)Objects |
|
101 | ## [๐](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures/#Objects)Objects |
|
102 | 102 | ```js |
103 | 103 | // Create an empty object |
104 | 104 | let myBlocks = {}; |