-
What would be the most appropriate output for the following code snippet?
var p=15 , q=10
var object = { p : 20 }
with(object)
{
alert(q)
}
-
- 20
- Error
- 15
- 10
- None of these
Correct Option: D
Firstly the interpreter checks obj for property b.But it doesn’t find any property b so it takes the value from outside the object within the code snippet.