New blocks to js lesson (#1446)

* added writing code guide

* added image

* bump pxt
This commit is contained in:
Peli de Halleux 2018-10-16 18:25:01 -07:00 committed by GitHub
parent 62f30624b9
commit 1738621e54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 66 additions and 1 deletions

View File

@ -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"
}
]
```

View File

@ -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.

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -43,6 +43,6 @@
},
"dependencies": {
"pxt-common-packages": "0.24.4",
"pxt-core": "4.1.37"
"pxt-core": "4.1.38"
}
}