Edit in JSFiddle

var loan = 100;
var interest = 0.05;


var owed = total(loan,interest);
document.getElementById("total").innerText = owed;

function total(a,b){
		var calculated = a + (a*b);
    return calculated;
<!-- Easy JavaScript # 28 - Value Returning JavaScript Functions -->
Welcome to the 28th Easy JavaScript tutorial, part of <a href="http://www.easyprogramming.net">EasyProgramming.net</a>. We continue to look at custom functions by practicing functions which return something. 
Returning information is optional. Returned information is often used as values for variables. 

Syntax of a function:</h2>

  function nameOfFunction(parameter1, parameter2...){
    //declare local variables
    //do something with parameter 1
    //do something with parameter 2
    //do other things
    //return value (optional)
Invoking a function
  <pre>nameOfFunction(argument1, argument2...);</pre>
Let's practice:</h2>
You borrowed $100 with an interest rate of 5%.<br />
The total owed with interest is: $<span id="total">___</span>
<br /><br />