Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (18 sloc) 874 Bytes
// Functions are data types that represents programs wrapped in values.
functionName(argument1, argument2)
//These function calls are known as expressions and may produce a value or execute something
alert("This is a function")
// Values given to functions are called arguments
alert("This is the argument")
//Here we use the console.log function to write out the argument that is outputted
var a = 10;
console.log("the value of a is", a);
//Functions can return values in an expression
console.log(Math.max(6, 10))
//Add the addition operator to combine the output of the Math.max function with + 50
console.log(Math.max(6, 10) + 50)
//The same expression except using the Math.min function
console.log(Math.min(6, 10) + 50)
//Other examples of functions - the confirm and prompt functions
confirm("This is also a function")
prompt("A question goes here", "...")