Home / CSE / Javascript - CS :: Discussion

Discussion :: Javascript - CS

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

    var a=5 , b=1

    var obj = { a : 10 }

    with(obj)

    {

    alert(b)

    }

  2. A.

     10

    B.

     Error

    C.

     1

    D.

     5

    View Answer

    Workspace

    Answer : Option C

    Explanation :

    The interpreter checks obj for property b, fails and takes it from outside of with.


Be The First To Comment