Unit 2 Diagnostic
with Carmen Salas • 2024/10/24
Questions
Write a function named
sum
that takes in a string of digits, the function should return the sum of each digit in the string. You can assume there will be no spaces in the given string, you should return an integer.
Write a function
isNumWithinRange
that takes in three integer arguments, a number, a min number, and a max number. The function should return a boolean based on if the first argument is between the range of the min and max number.
Write a function named
countFromOne
that takes in an integer argument, and returns an array of integers, where the elements are the numbers between 1 and the given argument, ordered from least to greatest.
Declare a function named
findShortestWord
, that takes an array of strings as an argument, and returns the shortest string in the array. If there is more than one shortest string, the function should return the first shortest string that appears in the array.
Write a function named
vowelCount
that takes in a string and returns an object where the keys are letters in the given string that are vowels and the value of each vowel key is a count of how many times the character appears in the string. For this problem, vowels area
,e
,i
,o
,u
.
Last updated