then it would still get the same result. So my question is , wouldnt this be a parameter then since there seems to be an inherent function being used regardless of what its named?
Parameters can be whatever you want to call them. In all functions, whether it is a “normal” function of here, where it is a callback function in the constructor of a Promise. There is nothing odd about that.
JS doesn’t care. But if you can it’s good to label them for what they are/do. With the Promise callback the convention is to call them that because that is an excellent descriptor of their purpose. But it is not hardcoded into JS to call them that. But it is a very strong convention and you might get some weird looks.
I hope you know what exactly argument and parameter mean.
Argument is the passing value and parameter is just the receiving variable , meaning argument is the actual value you are passing to the function when the function get called.
someFun(6,10) here 6 and 10 are arguments. While parameter is the variable that receives this value in the function declaration.
function someFun(num1,num2){
...........
}
here num1 and num2 are parameters which will get assigned by whichever value you passed as arguments
Agreed , which is why I had some confusion when some articles and videos refer to them as arguments. Because with both of our examples the words can be changed to anything , as they are just a placeholder.
Similar to how the (resolve , reject ) in my example can be changed to (anyOtherWord1,anyOtherWord2) is how your example
function someFun(num1,num2){
...........
}
can be changed to
function someFun(num3,num4){
...........
}
and still get the same result as long as the code in the blocks are the same.
Yeah consider them as just variable declarations but the value is assigned by javascript under the hood. You can name your variable whatever you want in the end only the data that holds matters
It’s like in geometry, a parabola is y = x^2. I can rename those, as long as I rename the axises as well. “x” and “y” are the parameters and the values that will be pumped into the formula are the arguments.
It was a lot of random websites , and YouTube videos that would take a long time to go through and find. I dont have the time currently , but if I get the chance I can send a direct message to you.