function helloWorld() {
console.log( 'Hello World!' )
}
// define the function
function helloWorld() {
console.log( 'Hello World!' )
}
helloWorld() // invoke the function
// => 'Hello World'
// name is a parameter
function helloPerson( name ) {
console.log( 'Hello ' + name + '!' )
}
helloPerson('Ramsay')
// => 'Hello Ramsay'
// Lets use some numbers because Math!
var startingNumber = 1
function doubleNumber( number ) {
return number * 2
}
doubleNumber(startingNumber)
// => 2
doubleNumber(10)
// => 20
var num = 10
function multiplyNumber( multiple ) {
num *= multiple;
}
multiplyNumber( 5 )
// => num = 50
multiplyNumber( 2 )
// => num = 100
var num = 10
function multiplyNumber( multiple ) {
num *= multiple;
}
multiplyNumber( 5 )
// => num = 50
multiplyNumber( 2 )
// => num = 100