diff --git a/docs/courses/blocks-to-javascript.md b/docs/courses/blocks-to-javascript.md index 9c4a2a0d..00fc0a63 100644 --- a/docs/courses/blocks-to-javascript.md +++ b/docs/courses/blocks-to-javascript.md @@ -23,6 +23,13 @@ Are you ready to try JavaScript to write your code? "url": "/courses/blocks-to-javascript/starter-blocks", "cardType": "side", "imageUrl": "/static/courses/blocks-to-javascript/starter-blocks.png" + }, + { + "name": "Writing Code", + "description": "Writing JavaScript on your own", + "url": "/courses/blocks-to-javascript/writing-code", + "cardType": "side", + "imageUrl": "/static/courses/blocks-to-javascript/writing-code.png" } ] ``` diff --git a/docs/courses/blocks-to-javascript/writing-code.md b/docs/courses/blocks-to-javascript/writing-code.md new file mode 100644 index 00000000..ad2c755e --- /dev/null +++ b/docs/courses/blocks-to-javascript/writing-code.md @@ -0,0 +1,58 @@ +# Writing Code + +## ~ avatar + +The syntax of JavaScript may seem daunting at first, but we've got help to get you over it. + +## ~ + +Programming languages are quite picky with the syntax, a single character can prevent your program to work! Let's review a few tools available in MakeCode to make your coding experience better. + +## JavaScript toolbox + +Just like the blocks toolbox, you can drag and drop snippets of JavaScript. It's a great way to discover how the syntax works. + +![JavaScript toolbox](/static/courses/blocks-to-javascript/jstoolbox.gif) + +## Suggestions and auto-completion + +When you start typing, you will quickly notice a menu of suggestion poping up right under the cursor. The editor is giving possible snippets of code based on what you've just written (This is something that professional developer use every day!). + +When you see the option you were trying to type, press **Enter** to insert it... rather than typing it entirely. + +![Auto completion with the keyboard](/static/courses/blocks-to-javascript/jsautocompletion.gif) + +## Pairing brackets + +Brackets and parenthesis always come in pairs, an opener and a closer. However, with so many brackets and parenthesis, it is can be challenging to match both. + +**Place your cursor on a bracket or parenthesis** and the editor will highlight the pair! + +![Bracket matching](/static/courses/blocks-to-javascript/jsbracketmatch.gif) + +## Indentation lines + +Once you have many nested loops and if statements, it can be challenging to see which "level" +you are in. + +Check the **indentation lines** to find your way back. + +![Indentation](/static/courses/blocks-to-javascript/jsscope.png) + +## Error squiggles + +When the editor detects a syntax error, it puts red squiggles where it thinks the error is. + +Place your mouse over the squiggle to get a detailled error message. + +![A squiggle message](/static/courses/blocks-to-javascript/jssquiggles.gif) + +### ~ hint + +Pro tip: always look at the first error and fix that one. All the other ones might be due to that one. + +### ~ + +## Auto-formatting + +Press ``Shift + Alt + F`` to auto-reformat your code and keep it tidy. \ No newline at end of file diff --git a/docs/static/courses/blocks-to-javascript/jsautocompletion.gif b/docs/static/courses/blocks-to-javascript/jsautocompletion.gif new file mode 100644 index 00000000..a5695658 Binary files /dev/null and b/docs/static/courses/blocks-to-javascript/jsautocompletion.gif differ diff --git a/docs/static/courses/blocks-to-javascript/jsbracketmatch.gif b/docs/static/courses/blocks-to-javascript/jsbracketmatch.gif new file mode 100644 index 00000000..7c5a6fdc Binary files /dev/null and b/docs/static/courses/blocks-to-javascript/jsbracketmatch.gif differ diff --git a/docs/static/courses/blocks-to-javascript/jsscope.png b/docs/static/courses/blocks-to-javascript/jsscope.png new file mode 100644 index 00000000..859a9b68 Binary files /dev/null and b/docs/static/courses/blocks-to-javascript/jsscope.png differ diff --git a/docs/static/courses/blocks-to-javascript/jssquiggles.gif b/docs/static/courses/blocks-to-javascript/jssquiggles.gif new file mode 100644 index 00000000..72824210 Binary files /dev/null and b/docs/static/courses/blocks-to-javascript/jssquiggles.gif differ diff --git a/docs/static/courses/blocks-to-javascript/jstoolbox.gif b/docs/static/courses/blocks-to-javascript/jstoolbox.gif new file mode 100644 index 00000000..a72b7046 Binary files /dev/null and b/docs/static/courses/blocks-to-javascript/jstoolbox.gif differ diff --git a/docs/static/courses/blocks-to-javascript/writing-code.png b/docs/static/courses/blocks-to-javascript/writing-code.png new file mode 100644 index 00000000..ec23dcee Binary files /dev/null and b/docs/static/courses/blocks-to-javascript/writing-code.png differ diff --git a/package.json b/package.json index bf2a1226..21bb72c7 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,6 @@ }, "dependencies": { "pxt-common-packages": "0.24.4", - "pxt-core": "4.1.37" + "pxt-core": "4.1.38" } }