Javascript – make function in object global

  function, global, javascript

Let’s say I have an object obj with a function f1 that accept two parameters a and b. The function is called as follows:

obj.f1(a,b);

Now I want to make f1 accessible without calling obj as follows:

f1(a,b);

Is this possible? If so, how may I achieve this?

Edit: If yes, is there a way to make all functions in the object global without knowing the specific functions?

Source: Ask Javascript Questions

LEAVE A COMMENT