JavaScript – A function, calling a function! :)

Hallo Leute! 🙂

Today I was putting some more efforts in JavaScript, and I think I have finally realized how the how the trick with a function calling a function is actually done.

Now, lets imagine the following easy scenario for an app – we have an input box and a button, whenever we click the button, the value from the input box is added to our total. As easy as this:presentation

You may see that I have started with 5, then 100, 500, 850 to get the value of 1455 all together. Not a great IT achievement, but the trick is that I have used a function calling a function for this.

At the start of the program, I have defined the variable countMe = makeCounter(); Thus, this countMe(), was associated with the onClick event of the button “O Yeah!”, and pretty much it worked! 🙂

Thank you for your interest, here comes the code:

Enjoy it! 😀

Tagged with: , ,