What are function parameters in JavaScript?

JavascriptWeb DevelopmentFront End Technology

With JavaScript, you can pass different parameters while calling a function. These passed parameters can be captured inside the function and any manipulation can be done over those parameters. A function can take multiple parameters separated by a comma. 


You can try to run the following code to learn how to add parameters to JavaScript functions −

         function sayHello(name, age) {
            document.write (name + " is " + age + " years old.");
      <p>Click the following button to call the function</p>

         <input type = "button" onclick = "sayHello('John', 27)" value = "Details">
Updated on 22-Jun-2020 14:40:13