10 more Javascript Challenges!

Leonardo Montini - Apr 24 '23 - - Dev Community

Do you know Javascript? After the success of the previous video, I've decided to make a second one with 10 more challenges to test your knowledge of the language.

These are 4 out of the 10 challenges you'll find in the video:


The ++ operator is really handy and you can put it either before or after the variable. But do you know the difference between the two?

let value = 3;
console.log(value++);
console.log(++value);
Enter fullscreen mode Exit fullscreen mode

You can use _ and the letter e in numbers and they're still valid!

const THE_ANSWER = 1_2 + 3e1;

console.log(THE_ANSWER);
Enter fullscreen mode Exit fullscreen mode

Isn't the output here supposed to be 7 on both cases? Actually, none of them is 7!

const x = "5";

console.log(1 + 1 + x);
console.log(x + 1 + 1);
Enter fullscreen mode Exit fullscreen mode

Can you spot any unintended side effect here?

let me = { name: "Leonardo", socials: { twitter: "@balastrong" } };

let luca = { ...me };
luca.name = "Luca";
luca.socials.twitter = "@puppo92";

console.log(me);
console.log(luca);
Enter fullscreen mode Exit fullscreen mode

If you're curious about the answers, you can find them in the video below. I hope you enjoy it!

In the video above, I go through all challenges and show the answer, but I also recorded a slower version where I actually explain them in more detail. If you're curious and want to learn more, you can find it here:

Let me know how many did you got right! :D


Thanks for reading this article, I hope you found it interesting!

I recently launched my Discord server to talk about Open Source and Web Development, feel free to join: https://discord.gg/bqwyEa6We6

Do you like my content? You might consider subscribing to my YouTube channel! It means a lot to me ❤️
You can find it here:
YouTube

Feel free to follow me to get notified when new articles are out ;)

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .