/uptown-func

Primary LanguageJavaScript

Uptown Func

A challenge in using functions as values.

a gif of dancing from the video for Uptown Funk

Introduction

Today we'll be looking at different ways to use functions when passed them in functions. Pay careful attention to the examples, and do your best not to skip any. They build!

Setup

This is a classic npm install and npm test assignment.

Challenges

  • call - given a function, it calls that function.
  • callTwice - given a function, it calls that function twice.
  • callXTimes - given a function and a number, it calls that function that number of times.
  • returnFromFunc - given a function, it returns the return value from calling that function.
  • modifyString - given a string and a function, it passes that string in a call to that function and returns the result.
  • modifyNumber - given a number and a function, it passes that number in a call to that function and returns the result.
  • modifyAnything - given a value of any kind, it passes that value in a call to the given function and returns the result. HINT: did you notice that the previous two were the same function with different parameter names?
  • twoFuncs - given two functions, it passes the first function's return value to the second, then return that function's return value.
  • threeFuncs - given three functions, it passes the first given function's return value ot the second, then passes that return value to the third, and, finally, returns that return value.
  • twoValues - given two values and a function, it passes both values in order to the function and returns the resulting return value.
  • twoValuesRTL - given two values and a function, it passes both values in REVERSE order to the function and returns the resulting return value.