DEV Community

Cover image for 10 JavaScript Quiz Questions and Answers to Sharpen Your Skills

10 JavaScript Quiz Questions and Answers to Sharpen Your Skills

Nick Scialli (he/him) on May 28, 2020

One way we can challenge ourselves to grow as JavaScript developers is to practice with quiz questions! The following questions are intended to be ...
Collapse
 
salyadav profile image
Saloni Yadav

Well picked examples. I got something similar to question 8 in one of the js interviews. Also, could you explain question 5 a little more in terms of the event loop? Why promise.all returns in the same order... wouldn’t the event loop resolve based on the settimeout delay once the promise is returned? Thanks

Collapse
 
haidv profile image
HaiDV • Edited

Promise.all waits all promised to be resolved. That 's the simplest explanation

Collapse
 
salyadav profile image
Saloni Yadav

Yes. But my question is regarding the order of printing.

Thread Thread
 
haidv profile image
HaiDV

It also ensure the order of data from promises. More info here: developer.mozilla.org/en/docs/Web/...

Thread Thread
 
salyadav profile image
Saloni Yadav

Thank you for the reference. :)

Thread Thread
 
ribizlim profile image
Mark Magyarodi

the console.log is done only once after all promises are resolved, not for each timeout

Thread Thread
 
salyadav profile image
Saloni Yadav

Will not the print be in the order of resolution even if they are all printed after all the promises are resolved?

Thread Thread
 
ribizlim profile image
Mark Magyarodi

No, Promise.all takes an array off promisses and resolves to an array of all promise results in the same order. The array is what will be printed...

Thread Thread
 
salyadav profile image
Saloni Yadav

Okay!! this is the exact clarification I was looking for! Thank you! :)

Collapse
 
hiboabd profile image
Hibo Abdilaahi

Such a coincidence that I stumbled across the fact that comparing arrays that are exactly the same as each other in appearance (e.g. ([] === [])) would yield a false boolean result. So I'm glad to get an explanation for that! And it was a much simpler explanation than I thought haha.

Really great article thanks!

Collapse
 
webmediacre profile image
Larry Saytee

Thanks.

Collapse
 
ziizium profile image
Habdul Hazeez

This repo comes to mind:

GitHub logo lydiahallie / javascript-questions

A long list of (advanced) JavaScript questions, and their explanations ✨

JavaScript Questions


I post multiple choice JavaScript questions on my Instagram stories, which I'll also post here! Last updated: December 24th

From basic to advanced: test how well you know JavaScript, refresh your knowledge a bit, or prepare for your coding interview! 💪 🚀 I update this repo regularly with new questions. I added the answers in the collapsed sections below the questions, simply click on them to expand it. It's just for fun, good luck! ❤️

Feel free to reach out to me! 😊
Instagram || Twitter || LinkedIn || Blog


See 17 Available Translations 🇪🇸🇮🇹🇩🇪 🇫🇷🇷🇺🇨🇳🇵🇹


1. What's the output?
function sayHi() {
  console.log(name);
  console.log(age
Collapse
 
nas5w profile image
Nick Scialli (he/him)

Thanks! This looks like a great reference.

Collapse
 
devlikhon profile image
Mehedi Hasan Likhon

Thank you!

Collapse
 
nas5w profile image
Nick Scialli (he/him)

You're welcome! I'll try to do some more next week

Collapse
 
bam92 profile image
Abel Lifaefi Mbula

Nice and very beginner friendly.

Collapse
 
ar7max profile image
Maxim • Edited

Answers to Sharpen Your Skills
beginner friendly

and this is what makes me cringe, cause fundamentals are fundamentals

Collapse
 
jfosela81 profile image
Jorge

You have a new susbcriber! Thanks for the quiz! I have learnt a little bit more of JS!

Collapse
 
nas5w profile image
Nick Scialli (he/him)

Wonderful! I hope to put out another version next week with more questions and aswers

Collapse
 
henryohanga profile image
Henry Ohanga

Excellent work Nick!

Collapse
 
codebeeme profile image
Cătălin Anghel-Ursu

Time for some mind food, and your JS quiz list was a tasty treat! You got a new follower.
Thanks for the nice work, Nick!

Collapse
 
shafkathullah profile image
Shafkathullah Ihsan

Cool!

Collapse
 
marjanb profile image
marjanb

Nice work, excellent examples!

Collapse
 
nas5w profile image
Nick Scialli (he/him)

Thanks!

Collapse
 
ememobongdev profile image
Ememobong-dev

i found this very helpful, i just began learning "Promise, Aysnc/Await" couldn't relate to the Promise question but i am 100% coming back to answer the quiz. Yup!! I love i saw this article. Thanks

Collapse
 
saraogipraveen profile image
Praveen Saraogi

Damn this proves, I've lot to learn about JS even after completing advance JS course from udemy.

Collapse
 
nas5w profile image
Nick Scialli (he/him)

Like any other language, JS has its fair share of idiosyncrasies. We all have more to learn!

Collapse
 
agathebadia profile image
Agathe Badia

Thanks a lot! I love the idea of little quizzes like these ones. I really feel that I learn something and discover more things than those huge challenges x.x