Academy Assignments - Solved!
Anagrams
Return true of false depends on provided strings are anagrams of eachother. One string is an anagram of another if it uses the same characters in the same quantity. Only consider characters, not spaces or punctuation. Consider capital letters to be the same as lower case.
Examples:
anagrams('rail safety', 'fairy tales') === true
anagrams('RAIL! SAFETY!', 'fairy tales') === true
anagrams('Hi there', 'Bye there') === false
Array Chunk
For given array and chunk size, divide the array into many subarrays where each subarray is of length chunk size.
Examples:
chunk([1, 2, 3, 4], 2) === [[ 1, 2], [3, 4]]
chunk([1, 2, 3, 4, 5], 2) === [[ 1, 2], [3, 4], [5]]
chunk([1, 2, 3, 4, 5, 6, 7, 8], 3) === [[ 1, 2, 3], [4, 5, 6], [7, 8]]
chunk([1, 2, 3, 4, 5], 4) === [[ 1, 2, 3, 4], [5]]
chunk([1, 2, 3, 4, 5], 10) === [[ 1, 2, 3, 4, 5]]
Capitalize
Write a function that accepts a string. The function should capitalize the first letter of each word in the string then return the capitalized string.
Examples:
capitalize('a short sentence') === 'A Short Sentence'
capitalize('a lazy fox') === 'A Lazy Fox'
capitalize('look, it is working!') === 'Look, It Is Working!'
Fib
Write a function which print out the n-th entry in the fibonacci series. The fibonacci series is an ordering of numbers where each number is the sum of the preceeding two.
Example sequence: [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
Examples:
fib(4) === 3
fib(15) === 610
Fizz Buzz
Write a program that console logs the numbers from 1 to n. But for multiples of three print “fizz” instead of the number and for the multiples of five prints “buzz”. For numbers which are multiples of both three and five print “fizzbuzz”.
Example:
fizzBuzz(5);
console.log(1)
console.log(2)
console.log('fizz')
console.log(4)
console.log('buzz')
Palindrome
For given string return true if the string is a palindrome or false if it is not.
Palindromes are strings that form the same word if it is reversed. Include spaces and punctuation in determining if the string is a palindrome.
Examples:
palindrome("abba") === true
palindrome("abcdefg") === false
Vowels
Write a function which returns number of vowels in given string.
Examples:
vowels('aeiou') === 5
vowels('Adam') === 2
vowels('Hello there!') === 4
Reverse String
For given string return a new string with the reversed order of characters.
Examples:
reverse('apple') === 'elppa'
reverse('hello') === 'olleh'
reverse('Greetings!') === '!sgniteerG'
More Reference
Reference Video Tutorial - https://www.youtube.com/watch?v=hdI2bqOjy3c&t=3699s