Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mikebranski
Created February 16, 2017 22:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikebranski/2cdf1f1d72dbbb665ca506914e4ba489 to your computer and use it in GitHub Desktop.
Save mikebranski/2cdf1f1d72dbbb665ca506914e4ba489 to your computer and use it in GitHub Desktop.
JavaScript exercise dealing with arrays

Count The Fives

Explanation: Create a function the takes an Array of numbers and returns an Integer count of the number of 5's in the Array

Bloc Objective: Write a for loop.

Content:

// Create a function the takes an Array of numbers and returns an
// Integer count of the number of 5's in the Array

function countFives(numbers) {

}

countFives([5, 6, 2, 5, 9, 3, 5]);
//=> 3

countFives([5, 6, 2, 5, 9, 3, 5, 4, 6, 7, 5, 4, 5, 5]);
//=> 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment