Q. The output for the following code snippet would most appropriately be

Code:
var a=5 , b=1
var obj = { a : 10 }
with(obj) 
{
      alert(b)
}
  • (A) 10
  • (B) Error
  • (C) 1
  • (D) 5
πŸ’¬ Discuss
βœ… Correct Answer: (C) 1
Explanation: The interpreter checks obj for property b, fails and takes it from outside of with.
Explanation by: Tanmay
The interpreter checks obj for property b, fails and takes it from outside of with.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
233
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Tanmay
Publisher
πŸ“ˆ
91%
Success Rate