Last active
March 24, 2017 11:43
-
-
Save dagolinuxoid/28a8648ac17535fe1d18854578d4ce68 to your computer and use it in GitHub Desktop.
#function #parameter #argument
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//just my own thoughts about it. Actually I've had similar issues before. | |
function confusion() { | |
var x = 5; // hard-coded assignment | |
console.log(x); | |
} | |
confusion(); // call a function with hard-coded 5 value | |
function dontBeConfused(x // hey I'm a parameter, that is a placeholder for a future value/argument ) { | |
// putting x parameter this way is pretty mutch the same as creating a variable inside the function | |
// in the snippet above, but it provides more ... flexability. | |
// In this case, later you can call/invoke a function with whatever argument you want, not only with 5. | |
console.log(x); | |
} | |
dontBeConfused(5 // at this point,it is not a parameter,it is an argument - a number 5); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment