javascript function passing parameters and string code example
Example 1: arguments object in javascript
var sum = 0;
function addAll(){
for (var i = 0; i<arguments.length; i++){
sum+=arguments[i];
}
console.log(sum);
}
addAll(1, 2, 3, 4, 5, 6, 7, 8, 9,10); //we can provide inifite numbers as argument
Example 2: How to Pass Parameter in JavaScript Function From Html
<!DOCTYPE html>
<html>
<head>
<title>function parameters javascript</title>
</head>
<body>
<button onclick="myfunctionName('rohan')">Click</button>
<script type="text/javascript">
function myfunctionName(a){
alert(a);
}
</script>
</body>
</html>