diff --git a/scripts.js b/scripts.js index bbbb844..56f46c3 100644 --- a/scripts.js +++ b/scripts.js @@ -1,32 +1,74 @@ // FILL IN THE FUNCTIONS BELOW - +'use strict' var sprintFunctions = { - largestEl: function(){ - // your code here + largestEl: function(arr){ + let bigEl = arr[0]; + for(let i=1; i< arr.length; i++) { + if(bigEl.length= 0; i--) { + newStr += str[i]; + } + return newStr; }, - loudSnakeCase: function(){ - // your code here + loudSnakeCase: function(str){ + let newStr = str.split(" ").filter(Boolean); + for(let i = 0; i x===comparedArr[i]); }, - fizzBuzz: function(){ - // your code here + fizzBuzz: function(n){ + const arr = []; + for(let i =1; i<=n; i++) { + i % 3 === 0 && i % 5 === 0 ? arr.push("FIZZBUZZ"): + i % 3 === 0 ? arr.push("FIZZ"): + i % 5 === 0 ? arr.push("BUZZ"):arr.push(i); + } + return arr; }, - myMap: function(){ - // your code here + myMap: function(arr,func){ }, - primes: function(){ - // your code here + primes: function(n){ + + let sqrtNum; + const storePrimes = []; + if(n===2) {return [2]} + if(n>2) {storePrimes.push(2,3)} + + for(let i =1; i