Javascript Quiz: How well do you know RefrenceError in JS

Опубликовано: 01 Март 2026
на канале: Programming Geek
98
6

Are you ready for another code challenge? Join me in this video as you test your coding knowledge with the simple quiz questions.

Don't forget to make your guess in the comments below.

-------------------------------------------------------------------------------------------

🔔Like and subscribe for more videos. 🔔

Connect me on linkedin :
https://www.linkedin.com/in/meenakshilodhi...
https://www.linkedin.com/in/rk-barnwal23/
------------------------------------------------------------------------------------------

Answer OPTION: B) a, b, ReferenceError

Explanation:
The code defines an object obj with properties a and b.

The for...in loop is used to iterate over the enumerable properties of obj. In each iteration, the property name is logged to the console.

The loop will iterate through the properties a and b and log their names: a and b.

After the loop, when console.log(prop) is called, it throws a ReferenceError because prop is not accessible outside the loop.

This is because const creates block-level scope, and the variable prop is scoped to the for loop.

Therefore, trying to access prop outside the loop results in a ReferenceError.