solvingfunctionsmorninglab
Title: Morning Lab
Creator: Thom Page
Topics: Problem solving with functions
Morning Lab  Problem solving
printGreeting
Write a function called printGreeting
with a parameter name
that returns a greeting with the argument interpolated into the greeting.
console.log(printGreeting("Slimer"));
=> Hello there, Slimer!
reverseWordOrder
Write a function reverseWordOrder
that accepts a single argument, a string. The function should return a string with the order of the words reversed. Don't worry about punctuation.
console.log(reverseWordOrder("Ishmael me Call"));
=> "Call me Ishmael"
console.log(reverseWordOrder("I use Lâncome on my comb"));
=> "comb my on Lâncome use I"
calculate
Write a function called calculate
.
This function should take three arguments, two numbers and a string.
Name the parameters num1
, num2
, and operation
.
If the function receives the string "add" for the operation parameter, it will return the sum of num1 and num2.
If the function receives the string "sub" for the operation parameter, it will return num1 minus num2.
Do the same thing for multiplication "mult", division "div", and exponent "exp" (where num2 is the exponent of num1).
console.log(calculate(4, 3, "sub"));
=> 1
console.log(calculate(4, 3, "exp"));
=> 64
pandigital numbers
A number of length n is 1ton pandigital if it makes use of all the digits 1 to n exactly once.

The number
15234
is 1ton pandigital. 
The number
333
is not 1ton pandigital. 
The number
0
is not 1ton pandigital. 
The number
987654321
is 1ton pandigital.
Write a function that checks if a number is 1ton pandigital.