• Tuesday , 14 November 2017

## Javascript Tutorial – 12 – Parameters in Functions

GitHub – https://github.com/buckyroberts
reddit – https://www.reddit.com/r/thenewboston/
Support – https://www.patreon.com/thenewboston
thenewboston – https://thenewboston.com/

Original source

## Related Posts

1. ##### Mobasher Zaid
November 6, 2017 at 12:00

What is wrong with your mic bro

2. ##### Hristina Christ
November 6, 2017 at 12:00

Thanks a million! ðŸ™‚

3. ##### 3dUber
November 6, 2017 at 12:00

var type = prompt("would you like subtraction, multiplication, addition, etc. please specify");
var x = prompt("Specify first number");
var x2 = prompt("Specify second number");
x=a+b;
return x;
}
function sub(a,b){
x=a-b;
return x;
}
function mul(a,b){
x=a*b;
return x;
}
function div(a,b){
x=a/b;
return x;
}
}
if(type=="subtraction"){
}
if(type=="multiplication"){
}
if(type=="division"){
}

4. ##### joshb729
November 6, 2017 at 12:00

{
x=a+b;
return x
}
var a = prompt("enter a ");
var b = prompt("enter b ");

When I type in 25 first prompt, 25 second prompt, I am getting: 2525 . Why?

5. ##### YouLostTheGame97
November 6, 2017 at 12:00

Exactly what I was thinking! But i'm a noob so I didn't think it mattered what I thought.

6. ##### temprmj1
November 6, 2017 at 12:00

the most comprehensive and interesting javascript tutorial on youtube.

7. ##### Jay Wren
November 6, 2017 at 12:00

Excellent series

8. ##### K. Anani
November 6, 2017 at 12:00

is it ok not to write var x???

9. ##### chopi1984
November 6, 2017 at 12:00

Hi guys, any problem with "RETURN"???

function parameter(a,b)
{
x=a+b;
}
parameter(3,5)

Broblem solved ðŸ˜€

10. ##### Max Patel
November 6, 2017 at 12:00

awesomeness

November 6, 2017 at 12:00

12. ##### THEGAMINGRULER
November 6, 2017 at 12:00

hmm this is like byval and byref in VB

November 6, 2017 at 12:00

@supersushi269 more extreme:

function hi(x){

for(i=0;i<x;i++){

document.write("!!!1")

}

}

document.write("OMG");
hi(9001);

lol

14. ##### Herp Derpingson
November 6, 2017 at 12:00

A real use of functions XD
TRY IT!

15. ##### Wills Easy Guitar
November 6, 2017 at 12:00

@kindofgameplay if you dont tell the function what the return value is, it treats it like a boolean (true or false). giving the variable x, it sends the value of the two numbers added.

16. ##### btownsnowbum
November 6, 2017 at 12:00

@ 3:30 , THAT = 5646

17. ##### tony hoss
November 6, 2017 at 12:00

super cool

18. ##### VoidghostII
November 6, 2017 at 12:00

simplest tutorials for javascript on the web, thanks for all the work man

19. ##### Bryan Lopez
November 6, 2017 at 12:00

@zurton ill fast forward a minute into the video and all he has written is var name = greg

20. ##### joe Hubbard
November 6, 2017 at 12:00

View my channel to find a link to my web development blog! I made it to get my ideas out and shows you how to do it. give it a look and make one and blog with me! we can start a little community of bloggers and share ideas! see you soon!

21. ##### Zhuoyan Xu
November 6, 2017 at 12:00

@jowish77 You don't eat heavy meal in the morning, If you are looking for a heavy dinner you don't come here. So if you want more advanced learning, go somewhere else. I find this tut perfect.

22. ##### Jowish Simon
November 6, 2017 at 12:00

I watched all the videos so far . Now I started feeling even if I learn something from u, I may not be able to use it effectively . It is only about spitting out "alert".
I know, this way I can understand the basics fast. But I hardly know, what all I can do with these functions & parameters.
This tutorial will not help u understand the actual usage of these powerful tools. We can't grow beyond "alert".

sorry bro.. ðŸ™‚

23. ##### RASHTG
November 6, 2017 at 12:00

@gorospakabum I think it's the same thing. I use var x = a + b; It will help me to not be confused later

24. ##### psmooth777
November 6, 2017 at 12:00

25. ##### zurton
November 6, 2017 at 12:00

goddamn watching your videos is always so painful. how you got to be the most popular "programmer" on youtube is beyond me.

26. ##### swagner
November 6, 2017 at 12:00

dude u have the best guides ever tysm

27. ##### gorospakabum
November 6, 2017 at 12:00

Can someone explain why you don't have to declare the variable x? It makes more sense to me that inside the function you had to state:

var x = a + b;