Home » JavaScript » JavaScript Functions » Question
  1. Consider the following code snippet
    opt.fun(p,q);

    Which is an equivalent code for the above code snippet?
    1. opt.fun(p && q);
    2. opt(fun)["p","q"];
    3. opt.fun(p) && opt.fun(q);
    4. opt["fun"](p,q);
    5. None of these
Correct Option: D

Another way to write opt.fun(p,q) is opt[“fun”](p,q).opt[“fun”] will access the property of the object and parenthesis will access the function present inside it.



Your comments will be displayed only after manual approval.