Giter Club home page Giter Club logo

callback_pt2's Introduction

The purpose of this module is to teach about callbacks!

Read the instruction carefully below, each function has it specific requirement

NOTE: run npm i

In the terminal run npm run test

filter - Return all elements of an array that pass a truth test.

reject - Return all elements of an array that don't pass a truth test.

uniq - Produce a duplicate-free version of the array.

map - Return the results of applying an iterator to each element.

reduce - Reduces an array or object to a single value by repetitively calling iterator(accumulator, item) for each item. accumulator should be the return value of the previous iterator call.

You can pass in a starting value for the accumulator as the third argument to reduce. If no starting value is passed, the first element is used as the accumulator, and is never passed to the iterator. In other words, in the case where a starting value is not passed, the iterator is not invoked until the second element, with the first element as its second argument.

Example: var numbers = [1,2,3]; var sum = reduce(numbers, function(total, number){ return total + number; }, 0); // should be 6

var identity = reduce([5], function(total, number){
  return total + number * number;
}); // should be 5, regardless of the iterator function passed in
       No accumulator is given so the first element is used.

callback_pt2's People

Contributors

ginnygu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.