Course Banner

Function with argument

this type of function is usually used when you want to call function and pass value into function argument while calling the function. The value will be dynamic. Write code once and use anywhere, save time.
Example :
function calculateSalary(salary,totalDays){
var perDay=salary/30;
var netSalary = totalDays*perDay;
document.getElementById('result').innerHTML="<strong>Your Salary is : "+ salary + " And your net salary is: "+netSalary+"</strong>";
<title> Calculate salary</title>
<div id="result"><h2>Calculate Salary</h2></div>
<td>Enter Salary : </td>
<td><input type="text" name="salary" id="salary"></td>
<td>Enter Total Days : </td>
<td><input type="text" name="days" id="days"></td>
<td> </td>
<input type="button" name="button" value="CalculateSalary1"