Giter Site home page Giter Site logo

lets-get-functional's Introduction

lets-get-functional

An exercise in problem solving in the functional idiom.

Setup

  1. If you haven't released your lodown library to npm (node package manager), follow the steps in this video to do so (using your GitHub username to create a unique name for your library):

    publishing-npm-packages

  2. FORK this repository on GitHub to your own GitHub account.

  3. From your FORK, use SSH to clone the repository into a Blank Cloud9 workspace.

  4. Once the Cloud9 workspace is finished initializing, from the bash terminal, run the command:

     npm install
    
  5. Install your lodown library by running the command and replacing <my-user-name> :

     npm install --save lodown-<my-user-name>
    
  6. Node is smart enough to find installed modules when you require() them by name. Open up index.js and import your lodown library using the node require() method like:

    const _ = require("lodown-<my-github-user-name>");

    Be sure to replace <my-user-name> with your actual username, duh. ;P

Solve

Code and test your solutions in index.js. Customer data is available to you in the Array, customers. Utilizing your lodown library, write functions that take the Array of customers and return the following (console.log() the results):

  1. Find the number of males.
  2. Find the number of females.
  3. Find the name and age of the oldest customer.
  4. Find the name and age of the youngest customer.
  5. Find the average balance of all the customers.
  6. Find how many customers' names begin with an arbitrary letter. Write a function to answer this question, then log an answer.
  7. Find how many customers' friends' names begin with an arbitrary letter. Write a function to answer this question, then log an answer.
  8. Find the names of all customers who are friends with a given customer (by name). i.e. Which customers have that customer's name in their friends list?
  9. Find the top 3 most common tags among the customers.
  10. Create a summary of genders, the output should be:
{
    male: 3,
    female: 4,
    transgender: 1
}

You should solve this using reduce().

Remember, in the node.js environment, you can both console.log() or use the dubugger to step through your code and inspect your work. Using the dubugger and stepping through your code will help you better understand the relationships and lifecycle of the Functions in your lodown library.

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.