About 11,100,000 results
Open links in new tab
  1. how can I pass multiple parameters in javascript function

    Aug 28, 2017 · You can use spread operator in ECMAScript 6 like this: function ceshi(...params) { console.log(params[0]); console.log(params[1]); console.log(params[2]); } Or use the …

  2. JavaScript Function Parameters - W3Schools

    The parameters, in a function call, are the function's arguments. JavaScript arguments are passed by value: The function only gets to know the values, not the argument's locations.

  3. Three ways to pass extra arguments to a function in JavaScript

    Apr 10, 2023 · When writing JavaScript code, you’ll often encounter a situation where you need to pass multiple arguments to a callback function, but it only accepts one. Today, we’ll look at …

  4. How to pass 2 parameters in a Javascript function - 3schools

    Jun 3, 2023 · In the example below, I have shown how to pass 2 parameters in a Javascript function. function myFunction(one, two) { alert(one); alert(two); myFunction(1,2); If you want to …

  5. The arguments object - JavaScript | MDN - MDN Web Docs

    Apr 10, 2025 · You can refer to a function's arguments inside that function by using its arguments object. It has entries for each argument the function was called with, with the first entry's index …

  6. How do you compose JavaScript functions with multiple parameters?

    Jun 10, 2024 · Our main tool for this is composition. We take an input, process it through a function, then pass it on to another function. And this is great, so long as all our functions take …

  7. Passing arguments forward to another javascript function

    Oct 12, 2010 · To overcome this, use Parameters type as follows: ` function a (...args: Parameters<typeof b>) { b (...args); } ` Or for another common complex example: ` async …

  8. JavaScript Passing parameters to a callback function

    Jan 9, 2024 · In this, The "GFGexample" is the main function and accepts 2 arguments, and the "callback" is the second one. The logFact function is used as the callback function.

  9. How to deal with multiple optional arguments in a JavaScript

    Aug 29, 2023 · Here's how we can use the rest parameter to handle multiple optional arguments: let greeting = extras[0] || 'Hello'; let punctuation = extras[1] || '!'; return `${greeting}, …

  10. Pass Multiple Arguments to a Function (How To) | JavaScript

    When calling a function, you're able to pass multiple arguments to the function; each argument gets stored in a separate parameter and used as a discrete variable within the function.

  11. Some results have been removed