Home > Net >  What does (some) mean in this javascript block of code?
What does (some) mean in this javascript block of code?

Time:04-30

I know what some() means in JavaScript but I don't understand what it means in this specific code block. Your help would be appreciated.

function myDisplayer(some) {
  document.getElementById("demo").innerHTML = some;
}

function myCalculator(num1, num2) {
  let sum = num1   num2;
  return sum;
}

let result = myCalculator(5, 5);
myDisplayer(result);

CodePudding user response:

In this code, “some” is a function parameter.

Function parameters are the names listed in the function definition.

Function arguments are the real values passed to (and received by) the function.

You might want to read this to get familiar with this concept.

CodePudding user response:

function myDisplayer(some) {
  document.getElementById("demo").innerHTML = some;
}

The some here in this code is an argument of type number, you can change the argument name to anything you like except reserved keywords.

Also, your question mention, what is some(), it is incorrect with reference to the code as you asked for a function named as some and your code refer to an argument named as some.

  • Related