by Mike Coleman | Mar 27, 2020 | Javascript, Javascript Functions
/* First class citizen – what does this mean? In javascript, functions can be passed into other functions functions can be stored in variables */ // Let’s talk about putting functions into variables /* Method 1: function doctorize(firstName) {...
by Mike Coleman | Mar 27, 2020 | Javascript, Javascript Functions
function calc(billAmount, taxRate = .05) { /* In the above line: function = keyword calc = function name billAmount = a parameter taxRate = another paramter, with a default vale { = scope start */ //This is the function body...
by Mike Coleman | Mar 27, 2020 | Javascript, Javascript Functions
// Functions are defined and called // This is a function definition: function calc() { //This is the function body console.log(‘Running Calculate!’); const total = 100 * 1.07; //sales tax 7%, as an example return total; } //This is a function call...
by Mike Coleman | Mar 27, 2020 | Javascript, Javascript Functions
Example: Math.max is a built in function in javascript. Math.max(4, 10, 11, 15) // returns 15, the highest of the numbers. 4,10,11,15 are called arguments. Arguments are passed to a function. 15 is called the returned value console.log(‘Text’) //...