-
If you have a function f and an object o, you can define a method named m of o with
-
- obj=fun.meth;
- obj=fun;
- obj.meth=meth.fun;
- obj.meth=fun;
- None of these
Correct Option: D
A method is nothing more than a JavaScript function that is stored in a property of an object. If you have a function fun and an object obj, you can define a method named meth of obj with the following line:
obj.meth = fun;