Karolina Ticha Karolina Ticha - 10 months ago 45
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?


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);