Karolina Ticha Karolina Ticha - 1 year ago 104
Javascript Question

Supose of JavaScript function parameter

I can't understand what supose have parameters part in JavaScript function. Let's say:

function sayWelcome(name) {
document.write("Welcome to our page " + name);

What thing should do that name on first line? Why I should use that?

Answer Source

Lets say you've got an automatic teller machine (atm). The atm wants to know who you are and what you want to return your money. So the atm function would look like

function atm(name, pin, money){
   if(all true){
      return money;

And the user would do:

atm("john doe", 1234, 1000);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download