One more example of JavaScript function with parameters, the function will return "Michael is 29 years old." and we are passing Michael and 29 as parameter value.
See the code snippet:
<!DOCTYPE html>
<html>
<head>
<title>Welcome to LearnKode - A code learning platform</title>
</head>
<body>
<p>Click the following button to call the function</p>
<input type="button" onclick="sayHello('Michael', 29)" value="Say Hello">
<script>
function sayHello(name, age)
{
document.write (name + " is " + age + " years old.");
}
</script>
</body>
</html>