JS Functions with Parameters

The Javascript Function Parameters are the names that are defined in the function definition and real values passed to the function in the function definition are known as arguments.

Syntax:

function Name(paramet1, paramet2, paramet3,...) 
{
     // Statements
}

Parameter Rules:

Parameters:

Default Parameter:

The default parameters are used to initialize the named parameters with default values in case, when no value or undefined is passed.

Syntax:

function Name(paramet1 = value1, paramet2 = value2 .. .) 
{
    // statements
}
<!DOCTYPE html>
<html>
<head>
    <title>JavaScript</title>
    <script>
        /* Functions With Parameters*/
        function hello(fname= "Yahoo",lname= "Baba") {
            document.write("Hello" + fname + " " + lname + "<br>");
        }
            
        hello("Ram","Singh");
        hello("Salman", "Khan");
    </script>
</head>
<body>
</body>
</html>