• Tuesday , 14 November 2017

Javascript Tutorial – 12 – Parameters in Functions

Code Canyon



Facebook – https://www.facebook.com/TheNewBoston-464114846956315/
GitHub – https://github.com/buckyroberts
Google+ – https://plus.google.com/+BuckyRoberts
LinkedIn – https://www.linkedin.com/in/buckyroberts
reddit – https://www.reddit.com/r/thenewboston/
Support – https://www.patreon.com/thenewboston
thenewboston – https://thenewboston.com/
Twitter – https://twitter.com/bucky_roberts

Original source

3d Ocean

Related Posts

30 Comments

  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

    made a bad ass calculator lol

    var type = prompt("would you like subtraction, multiplication, addition, etc. please specify");
    var x = prompt("Specify first number");
    var x2 = prompt("Specify second number");
    function add(a,b){
    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=="addition"){
    alert(add(x, x2));
    }
    if(type=="subtraction"){
    alert(sub(x, x2));
    }
    if(type=="multiplication"){
    alert(mul(x, x2));
    }
    if(type=="division"){
    alert(div(x, x2));
    }

  4. joshb729
    November 6, 2017 at 12:00

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

    alert(add(a,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;
    alert(x);
    }
    parameter(3,5)

    Broblem solved 😀

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

    awesomeness

  11. sandilya dhanwada
    November 6, 2017 at 12:00

    @MegaTeddy000 In 'alert(add(32, 56))' , we tell JavaScript 'Open a popup box and for the value to be displayed, call the add() function with parameters 32 and 56'. So 'function add()' is read & the two numbers are added. Now assume that there is no 'return x' statement. So the addition of 32 & 56 will surely be performed; but the alert does not have a value to display. If you do write 'return x', the sum of 32 & 56 is calculated and returned i.e. alert( add(32,56) ) = alert(88) !

  12. THEGAMINGRULER
    November 6, 2017 at 12:00

    hmm this is like byval and byref in VB

  13. Braden Best
    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
    alert(add(1,add(1,add(1,add(1,add(1,add(1,add(1,add(1,add(1,add(1,add(1,add(1,0)))))))))))));
    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

    @zurton <—Hater, why u mad?

  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;

  28. dougieladd
    November 6, 2017 at 12:00

    You are a very good teacher. In fact I've seen loads of these tuts and I have to say the usual nerd teaching is garbled to show how clever the teacher is… but in your case you just tell it like it is. Nice one!

  29. anonymous7129152938
    November 6, 2017 at 12:00

    Nice!

  30. Graeme Houston
    November 6, 2017 at 12:00

    WOW, how to learn the basics of JavaScript in a couple of hours, invaluable set of videos – Keep up the good work!

Leave A Comment

You must be logged in to post a comment.