Global

Methods

countNumbers(arr) → {object}

Count all the numbers in an array
Parameters:
Name Type Description
arr Array.<number> An array containing numbers
Source:
Returns:
- an object where the key is the number, and the value is the count of that number ex: countNumbers([1,1,1,2,2,3,4]) returns { 1:3, 2:2, 3:1, 4:1 }
Type
object

getCountriesSortedByPopulation(arr) → {Array.<string>}

Returns an array of country names sorted in descending order by population
Parameters:
Name Type Description
arr Array.<object> The input array. Objects will be in the form: { country: "foo", population: 10 }
Source:
Returns:
- Returns an array of country names, sorted by their population in descending order
Type
Array.<string>

isOdd(n) → {boolean}

Determines whether or not a number is odd.
Parameters:
Name Type Description
n number The input number.
Source:
Returns:
- True if n is odd, false if n is even, or not a number.
Type
boolean

numberOfDigits(n) → {number}

Determines the number of digits in a given number.
Parameters:
Name Type Description
n number The input number.
Source:
Returns:
- Returns how many digits are in the input.
Type
number

removeEvenStrings(arr) → {Array.<string>}

Removes all strings with an even character count from an array of strings.
Parameters:
Name Type Description
arr Array.<string> The input array of strings
Source:
Returns:
- Returns the strings in arr that have an odd number of characters
Type
Array.<string>

removeNumbersAtOddIndices(arr) → {Array.<number>}

Remove all numbers at odd indices from an array
Parameters:
Name Type Description
arr Array.<number> The input array
Source:
Returns:
- An array removing all elements initially appearing at an odd index
Type
Array.<number>

removeOddNumbers(arr) → {Array.<number>}

Remove all odd numbers from an array
Parameters:
Name Type Description
arr Array.<number> The input array
Source:
Returns:
- The input array with all odd number removed
Type
Array.<number>

removeVowels(str) → {string}

Removes all vowels from an input string. Treat y as a consonant, not a vowel
Parameters:
Name Type Description
str string The input string
Source:
Returns:
- Returns a new string without any vowels.
Type
string

secondSmallest(arr) → {number}

Return the second smallest number in an array of numbers
Parameters:
Name Type Description
arr Array.<number> The input array of numbers
Source:
Returns:
- Returns the second smallest number.
Type
number

sevenBoom(n) → {Array.<number>}

Write a function that returns all the values from 1 to n inclusive, replacing all numbers that are a multiple of seven, or contain seven with "BOOM". Sample Input: 20 Sample Output: [1,2,3,4,5,6,'BOOM',8,9,10,11,12,13,'BOOM',15,16,'BOOM',18,19,20]
Parameters:
Name Type Description
n number The number to count up to
Source:
Returns:
- An array matching the pattern described above
Type
Array.<number>