Thursday, 15 July 2010

Work around without using javascript object in this case -


I was used to programming using python but I am using javascript for some project . In Python, the concept of OOP was a bit easier than Javascript which I'm just reading. That being said, I'm not very comfortable using the javascript object and prototype right now. In the meantime, can I get the following without using the object? I'm not a pure programmer (always taken as a hobby), so please bear with me:

  function func1 (arg1) {item does. .1 .. For example ... var result = ARG1 * 2; Item does .2 for example ... var resultSq = arg * arg; ......}   

I want another function, say func2 which when calls func1; Funct1 only responds by displaying items ... 1 and returning results.

In other words, I want to know who called the function and if sorry for changing the statement execution, it is very easy. / P>

Where is the caller:
    

Reference:

Passing an ID:

As the caller really depends on how the interrogator actually acts differently If you have a statement, it checks to see what action should be taken.

  function doSomething (action number) {if (actionNumber == 1) {return 1; } And if (action number == 2) {return1; } // etc ...} function2 () {doSomething (1); }    

No comments:

Post a Comment