-
Write a function
largestwhich returns the largest element in an array of numbers. -
Write a function
trimwhich returns a copy of an array removing the elements at the beginning or end that arenull. -
Write a function
arraySumwhich returns the sum of the elements in an array. -
Write a program that produces the sum of each column in a CSV file. To read the file:
const fs = require("fs"); let fileContent = fs.readFileSync("some_data.csv").toString();
-
Write a function
countAppearanceswhich receives an array of stringsA(a list of words) and a stringw(a single word), and returns how many timeswappears inA. -
Write a function
reversewhich receives an array and returns a new array with the same elements in reverse order. If the input array is[1, 2, 3, 4, 5], the function should return[5, 4, 3, 2, 1]. -
Write a function
aboveAveragethat receives an array of numbers and returns the fraction (between 0.0 and 1.0) of numbers in the array the are greater than the average of the array. -
Write a function
firstNonRepeatedthat receives a string like"aabbcdddeffgh"and returns the first letter in the string which doesn't have consecutive repetitions (in the example would bee). -
In the game of Fizz Buzz, kids take turns in saying the natural numbers, but when a number is divisible by 3, they say "Fizz", when the number is divisible by 5 they say "Buzz", and when the number is divisible by 3 and 5 they say "Fizz Buzz". If you put the consecutive responses (either an integer or a string) in an array it would look like:
[ 1, 2, "Fizz", 4, "Buzz", "Fizz", 7, 8, "Fizz", "Buzz", 11, "Fizz", 13, 14, "FizzBuzz" /* ... */, ];
Write a function that receives an integer length N as a parameter and produces the
FizzBuzzarray of length N. -
Write a function
range(a, b)that receives two integers and produces an array with the consecutive numbers starting atabut excludingb. For instance,range(4, 10)produces[4, 5, 6, 7, 8, 9]. -
Write a function that receives an array of arrays of numbers, such as
[[1, 2, 3], [100, 10], [-5, -7]]and returns an array with the minimum values in each array, that is:[1, 10, -7]. -
Write a function
duplicatewhich receives an array and an integernand returns a new array withnconcatenated copies of the original array. -
Write a function that receives two arrays
AandBand returns an array with the elements inAthat are not present inB. -
Write a function that receives two strings and returns
trueif they are anagrams. Two Spanish words that are anagrams are "esponja" and "japones" (accents/tildes are not taken into account). -
Write a function that receives a string and reverses the order of all the vowels in the string:
reverseVowels("I love burritos")gives"o livu berrotIs. -
Given an array of integers (let's call it
x), calculate the percentage for the number of positive integers, negative integers, and zeros inx. -
Write a function that receives an array of numbers, and returns the median.