JS - Higher-Order Functions

Card Set Information

Author:
jasminep16
ID:
308293
Filename:
JS - Higher-Order Functions
Updated:
2015-09-22 21:26:06
Tags:
javascript
Folders:

Description:
Chapter 5 of Eloquent JavaScript: A modern introduction to programming
Show Answers:

Home > Flashcards > Print Preview

The flashcards below were created by user jasminep16 on FreezingBlue Flashcards. What would you like to do?


  1. Abstraction
    • Abstraction hide details and give us the ability to talk about problems at a higher lever.
    • reduce(); - function name
  2. Higher-Order Functions
    Functions that operate on other functions, either by taking them as arguments or by returning them
  3. function unless(test, then) {
    if(!test) then();
    }

    repeat(3, function(n) {
    unless(n % 2, function() {  console.log(n, "is even");
    });
    In the example, the n variable is a parameter to the outer function
  4. apply method
    Pass it an array (or array-like object) of arguments, and it will call the function with those arguments
  5. JSON
    JavaScript Object Notation
  6. function JSON.stringify
    convert data to JSON string
  7. function JSON.parse
    method parses a string as JSON, optionally transforming the value produced by parsing.
  8. Pure function
    A function that does not modify the array that is given
  9. forEach() array method
    • executes a provided function once per array element.
    • arr.forEach(callback[, thisArg])
  10. filter() array method
    • creates a new array with all elements that pass the test implemented by the provided function.
    • arr.filter(callback[, thisArg])
  11. map() array method
    • creates a new array with the results of calling a provided function on every element in this array
    • arr.map(callback[, thisArg])
  12. reduce() array method
    applies a function against an accumulator and each value of the array (from left-to-right) to reduce it to a single value

    arr.reduce(callback[, initialValue])
  13. bind() method
    creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called.

What would you like to do?

Home > Flashcards > Print Preview