Vidyalelo
JavaScript · Q32

Basic And Variables

Programming · JavaScript · question 32

Q32

The output for the following code snippet would most appropriately be var a=5 , b=1 var obj = a : 10 with(obj) alert(b)

A.
10
B.
Error
C.
1
Answer
D.
5

Answer: Option C

Solution

Answer: Option C
Solution:
The interpreter checks obj for property b, fails and takes it from outside of with.