Blocks2Javascript review edits (#1341)
This commit is contained in:
parent
1a9235e333
commit
2e1df3d70d
@ -12,14 +12,14 @@ Are you ready to try JavaScript to write your code?
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"name": "Hello JavaScript",
|
"name": "Hello JavaScript",
|
||||||
"description": "Learn to convert your block code in JavaScript",
|
"description": "Learn how to convert your code from blocks to JavaScript",
|
||||||
"url": "/courses/blocks-to-javascript/hello-javascript",
|
"url": "/courses/blocks-to-javascript/hello-javascript",
|
||||||
"cardType": "side",
|
"cardType": "side",
|
||||||
"imageUrl": "/static/courses/blocks-to-javascript/hello-javascript.png"
|
"imageUrl": "/static/courses/blocks-to-javascript/hello-javascript.png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Starter Blocks",
|
"name": "Starter Blocks",
|
||||||
"description": "Start from blocks to jump into JavaScript",
|
"description": "Begin with blocks and then jump into JavaScript",
|
||||||
"url": "/courses/blocks-to-javascript/starter-blocks",
|
"url": "/courses/blocks-to-javascript/starter-blocks",
|
||||||
"cardType": "side",
|
"cardType": "side",
|
||||||
"imageUrl": "/static/courses/blocks-to-javascript/starter-blocks.png"
|
"imageUrl": "/static/courses/blocks-to-javascript/starter-blocks.png"
|
||||||
|
@ -2,17 +2,17 @@
|
|||||||
|
|
||||||
## ~ hint
|
## ~ hint
|
||||||
|
|
||||||
Use your blocks knownledge to learn JavaScript faster.
|
Use your knownledge of blocks to learn JavaScript faster.
|
||||||
|
|
||||||
## ~
|
## ~
|
||||||
|
|
||||||
MakeCode can convert your blocks to JavaScript and back. Start from blocks and jump into JavaScript for an easier start.
|
MakeCode can convert your blocks to JavaScript and back. Start your program with blocks and then jump into JavaScript as an easy way to begin working in the code.
|
||||||
|
|
||||||
## Do it blocks then convert
|
## Do it blocks then convert
|
||||||
|
|
||||||
So you are pretty familiar with the blocks editor and still getting used to JavaScript. MakeCode can convert any block code into JavaScript. Let's see it in action.
|
So you are pretty familiar with the blocks editor and still getting used to JavaScript? MakeCode can convert any block code into JavaScript. Let's see it in action.
|
||||||
|
|
||||||
* create a simple program in the code editor
|
* Create a simple program in the code editor.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonPressed(Button.A, function () {
|
input.onButtonPressed(Button.A, function () {
|
||||||
@ -26,7 +26,7 @@ input.onButtonPressed(Button.A, function () {
|
|||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
* click on the **{} JavaScript** button in the top menu to convert the blocks to JavaScript. Voila!
|
* Click on the **{} JavaScript** button in the top menu to convert the blocks to JavaScript. Voila!
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
input.onButtonPressed(Button.A, function () {
|
input.onButtonPressed(Button.A, function () {
|
||||||
@ -42,9 +42,9 @@ input.onButtonPressed(Button.A, function () {
|
|||||||
|
|
||||||
## Go back to blocks
|
## Go back to blocks
|
||||||
|
|
||||||
Do you feel like editing blocks again? MakeCode can convert back your JavaScript code into blocks.
|
Do you want to go back to editing with blocks again? MakeCode can convert your JavaScript code back into blocks.
|
||||||
|
|
||||||
* replace a few dots '.' with hashmarks '#'
|
* Replace a few dots `.` with hashmarks `#`.
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
input.onButtonPressed(Button.A, function () {
|
input.onButtonPressed(Button.A, function () {
|
||||||
@ -60,11 +60,11 @@ input.onButtonPressed(Button.A, function () {
|
|||||||
|
|
||||||
### ~ hint
|
### ~ hint
|
||||||
|
|
||||||
So you change your JavaScript code and nothing works anymore, there are tons of red squiggle and you don't understand why... Don't panic, use the **Undo** button to revert your changes until everything works again.
|
Well, you changed your JavaScript code and nothing works anymore. You see gobs of red squiggles and you don't understand why... Don't panic, use the **Undo** button to revert your changes until everything works again.
|
||||||
|
|
||||||
### ~
|
### ~
|
||||||
|
|
||||||
* click on the **Blocks** button in the top to convert the JavaScript back to blocks.
|
* Click on the **Blocks** button in the top to convert the JavaScript back to blocks.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonPressed(Button.A, function () {
|
input.onButtonPressed(Button.A, function () {
|
||||||
@ -80,9 +80,9 @@ input.onButtonPressed(Button.A, function () {
|
|||||||
|
|
||||||
## Grey blocks are a good sign!
|
## Grey blocks are a good sign!
|
||||||
|
|
||||||
If you start to writing more complex JavaScript (good job!), MakeCode might not be able to convert it back to blocks. In that case, you will see _grey blocks_ in your block code. They represent chunks of JavaScript that are too complicated for blocks.
|
If you start to write more complex JavaScript (it's great that you are!), MakeCode might not be able to convert it back to blocks. In that case, you will see _grey blocks_ in your block code. They represent chunks of JavaScript that are too complicated for blocks.
|
||||||
|
|
||||||
* go back to **JavaScript** and add a second frame to create animation. This is something you can do in JavaScript but not in blocks.
|
* Go back to **JavaScript** and add a second frame to create animation. This is something you can do in JavaScript but not in blocks.
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
input.onButtonPressed(Button.A, function () {
|
input.onButtonPressed(Button.A, function () {
|
||||||
@ -96,7 +96,7 @@ input.onButtonPressed(Button.A, function () {
|
|||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
* go to the **Blocks** editor and you will see a big **grey** block in the button handler. This is because you are creating code too complex for the blocks. Take it as a compliment!
|
* Go to the **Blocks** editor and you will see a big **grey** block in the button handler. This is because you are creating code too complex for the blocks. Take it as a compliment!
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonPressed(Button.A, function () {
|
input.onButtonPressed(Button.A, function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user