Skip to content

Instantly share code, notes, and snippets.

@abalogun
Forked from mmeigooni/mod3-assessment.md
Created April 21, 2017 03:01
Show Gist options
  • Save abalogun/4551b223ed2e3beadb29563fbb30a897 to your computer and use it in GitHub Desktop.
Save abalogun/4551b223ed2e3beadb29563fbb30a897 to your computer and use it in GitHub Desktop.

Module 3 Assessment

This assessment is a recorded assessment. Before you start, please remember to start recording your screen. Please only submit your video and gist once you have completely finished your solutions!

Time limit: 1 hour

Part 1

Write a function that takes 3 words and returns a single count of all their letters.

function combinedCharacterCount(salesTeam) {
// your solution here
}

Part 2

Below is a simple assert function and its invocation. Add this to your code and make sure that the test passes.

Note: This is a slightly different assert than what you are used to. Take a moment to look at its declaration and invocation in order to identify how it's different to what you've seen in the past.

function assert(expectedBehavior, descriptionOfCorrectBehavior) {
  if (!expectedBehavior) {
    console.log(descriptionOfCorrectBehavior);
  } else {
    console.log('test passed');
  }
}

assert(combinedCharacterCount('I', 'am', 'here') === 7, "should correctly count the total number of characters");

Part 3

For this part, let’s pretend you’re working for a venture capital company interested in analyzing some data we have about startup companies. You’ve been given a small subset of this data to begin working with. Take a moment to look over how the data is structured:

var companies = [
  {
    "name" : "AdventNet",
    "category_code" : "enterprise",
    "number_of_employees" : 600,
    "founded_year" : 1996,
    "total_money_raised" : "$0"
  },
  {
    "name" : "TechnologyGuide",
    "category_code" : "web",
    "number_of_employees" : 10,
    "founded_year" : 2001,
    "total_money_raised" : "$0"
  },
  {
    "name" : "Wetpaint",
    "category_code" : "web",
    "number_of_employees" : 47,
    "founded_year" : 2005,
    "total_money_raised" : "$39.8M"
  },
  {
    "name" : "Zoho",
    "category_code" : "software",
    "number_of_employees" : 1600,
    "founded_year" : 2005,
    "total_money_raised" : "$0"
  },
  {
    "name" : "Omnidrive",
    "category_code" : "network_hosting",
    "number_of_employees" : null,
    "founded_year" : 2005,
    "total_money_raised" : "$800k"
  },
  {
    "name" : "Digg",
    "category_code" : "news",
    "number_of_employees" : 60,
    "founded_year" : 2004,
    "total_money_raised" : "$45M"
  },
  {
    "name" : "Geni",
    "category_code" : "web",
    "number_of_employees" : 18,
    "founded_year" : 2006,
    "total_money_raised" : "$16.5M"
  },
  {
    "name" : "StumbleUpon",
    "category_code" : "web",
    "number_of_employees" : null,
    "founded_year" : 2002,
    "total_money_raised" : "$18.5M"
  }
];

Given an array of companies, return an array of all the company names founded last century

var collectCompaniesFoundedLastCentury = function (companies) {

};

Part 4

Use the assert function provided in Part 2 to write a single meaningful test for collectCompaniesFoundedLastCentury, using companies as the input.

Note: You will either need to use JSON.stringify(); or the below areArraysEqual function in order to test array/object equality.

function areArraysEqual(array1, array2) {
  var areEqual = true;
  for (var i = 0; i < array1.length; i++) {
    if (array1[i] !== array2[i]) {
      areEqual = false;
    }
  }
  return areEqual && array1.length === array2.length;
}

Part 5

Given an array of companies, return an array of all the company names that raised 20 million dollars or more. Start this problem by writing a single failing assert function before filling out the logic in the function body.

var collectTwentyMillionDollarCompanies = function (companies) {

};

Submitting your work

Please upload the video of your assessment to YouTube as an unlisted video (instructions). Once you do so, submit a link to the video and a gist of your code in this form.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment