Member-only story
Answer These 7 JavaScript Questions to Prove You’re Not a Beginner Anymore
JavaScript is often seen as the go-to language for web development, but mastering it is no small feat. From quirky behaviors to intricate concepts, this language has its fair share of challenges. If you think you’ve moved past the beginner stage, it’s time to put your skills to the test. Below, I’ve compiled 7 questions that cover key JavaScript concepts — ranging from closures and hoisting to the infamous quirks of type coercion. If you can answer them correctly, you’re definitely on your way to becoming a JavaScript pro. Ready to take on the challenge? Let’s dive in!
Not a Medium member? Read this article here
1. What is the output of the following code?
console.log(0.1 + 0.2 === 0.3);
- Answer:
false
- Explanation: Due to floating-point precision issues,
0.1 + 0.2
results in0.30000000000000004
instead of0.3
.
2. How does var
, let
, and const
differ in terms of scope and re-assignment?
- Answer:
var
: Function-scoped, can be re-declared and re-assigned.let
: Block-scoped, cannot be re-declared but can be re-assigned.