Javascript

FCC: Sorted Union (JavaScript Intermediate Algorithm)

In FCC Challenge Sorted Union we’re tasked with flattening an array that has multiple arrays and removing duplicates in the array while still keeping the same array order. function uniteUnique(arr) { return arr; } uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]); Because the number of arguments passed into the function is random we…

Read More

FCC: Boo Who (JavaScript Intermediate Algorithm)

In FCC challenge Boo Who we’re trying to determine values being passed into the booWho function is a boolean. function booWho(bool) { // What is the new fad diet for ghost developers? The Boolean. return bool; } booWho(null); To determine whether the value in a variable is boolean or another type we can use the…

Read More

FCC: Missing Letters (JavaScript Intermediate Algorithm)

In FCC challenge Missing Letters we’re tasked with finding the missing letter in a string of sorted alphabets: function fearNotLetter(str) { return str; } fearNotLetter("abce"); First we need to convert the string of alphabets to their UTF-16 unicode equivalent using the charCodeAt function. Then store the unicode in an array for comparison. for (let x…

Read More

FCC: DNA Pairing (JavaScript Intermediate Algorithm)

In FCC challenge DNA Pairing we’re generating pairing of DNA and then inserting it into a multidimensional array. function pairElement(str) { return str; } pairElement("GCG"); We first need to split the str string into an array. Putting each letter in the array allows us to use the forEach function for each element of the array.…

Read More

FCC: Pig Latin (JavaScript Intermediate Algorithm)

In Free Code Camp’s Pig Latin Challenge we need to convert English dictionary words to pig latin using the following rules: Move the first set of consonants up to the first vowel to the end of the word Then add “ay” as the suffix If the first letter of the word is a vowel, then…

Read More