My Java Script learning journey

Hey. I decided it was time for me to learn Java script, so this is where I will post some related things. I might as for occasional help, and just post about something I learned today. Another reason I am making a topic for this is so I can stay dedicated to it. I will try and give at least one daily update on this topic. If you have any advice, I would love to hear it! Just prepare for a lot of questions.

Make Code mayhem

I will be putting a hold on Make Code mayhem, but I won’t give up on that topic. I will create it but in java script. I won’t let your all’s amazing art go to waist!

my goals are:

  1. Code a game in Make Code arcade with 100 percent Java Script.
  2. Be able to write and read Java Script fluently.
  3. Learn new methods of coding with Java Script.

Thanks for your time!

6 Likes

Use the toolbox.

You noticed that it still exists when switching to JavaScript, yes? It works the same way! Drag a code snippet into your code. You’ll just need to replace the placeholders with real values or variable names.

Can’t figure out how to write something in JavaScript? Create a blank project and build it in Blocks. Then, switch to JavaScript to see how your blocks have been translated.

You’re learning a new language. Start with your familiar language and translate slowly.

Build something simple, like a chase and collect game. (We call it Chase the Pizza in the tutorials.) Then keep enhancing it with skills that you already know in Blocks.

6 Likes

while you do that could u also teach me things that u learn too? i want to learn to!

3 Likes

wow yeah definitely use this dont hesitate and call yourself a disgrace for using the toolbox like i did

4 Likes

That’s a good idea! my first game in blocks was a gremlin chasing a person around, and the player had to survive a minute timer. I Will try and make something like that tomorrow. Thank you!

But for now here is Harry:

3 Likes
A very (not) short list…
  • Highlighting a word or phrase will sort of soft highlight all other occurrences of that string. These highlights are also marked on the right scroll bar as little grey boxes. This is insanely helpful for finding other places where you’ve used a variable and jumping between them quickly.
  • Highlighting something and pressing ctrl D will highlight the next occurrence of that thing, and keep pressing it to highlight more. Then you can edit all those places at once!
  • Use comments. Just… please… :pleading_face:
  • Look through the Explorer files! They are really cool!
  • Browser Events is the only extension you can’t make yourself, but you don’t have to make everything!
  • Look at other peoples’ code! But…
  • Credit others when you copy their code! It’s just good practice and will be a good habit later on.
  • “JavaScript” = static typescript. Here are the docs: https://makecode.com/language
  • Ping me when you ask for help :wink: or Richard I guess.
2 Likes

I love Harry.

1 Like

Day 2 of my Java script learning journey! I created a little chase the pizza:

@Hulahoop I would love to help teach you the things I learn to! I will be providing daily updates so:

  1. I learned that some of these { } Mean something in logic. Kind of like and outline of what’s in a logic statement.
  2. you can add comets into your code with // There really help full, not just for clarifying your code, but for finding it to.
  3. logic feels kind of complex. I need some help on it.
3 Likes

(Java script day 2) Harrys’s parkour adventure:

It’s nothing crazy, just a difficult plat former with some secrets (Can you make it to the end?)

Most of it was made in blocks, but the significance is when I try to create another, I can look at the code in a Java script and copy it down into the new one.This is how I learned blocks with the make code arcade skill maps most notably the monkey one. @WoofWoof Could you explain these a tiny bit more?

1 Like

The curly braces in C-style languages indicate statement blocks. They’re used to extend a single statement to include multiple statements.

For example, you can write a for() loop like this:

for (let i: number = 0; i < 10; i++)
    console.log(`i == ${i}`);

You also can write it like this, which is safer:

for (let i: number = 0; i < 10; i++) {
    console.log(`i == ${i}`)
}

Why are the curly braces better? Because now you can do this:

let sum: number = 0
for (let i: number = 0; i < 10; i++) {
    console.log(`i == ${i}`)
    sum += i
}
game.splash("The sum of the numbers 1 through 10 is", `${sum}`)

If you write the same code without the curly braces, then only the statement that appears after the for() declaration is considered part of the loop. Try it yourself to see the difference.

To make your code more readable, safer, and extensible (or extendable, depending on who you ask), always use curly braces with loops and decision structures.


You also can write multi-line comments (also known as block comments) like this:

/*
   This is a comment
   that spans multiple lines.
*/
2 Likes