Tell us what’s happening:
Is there a way to talk this through with someone? I know my code is chunky but works for all but the last test. Curious to try to work it through with someone.
Your code so far
function sumFibs(num) {
let arrFib = [1,1]
let addArray =[]
for(let i = 1; num > arrFib[0] ; i++){
arrFib.unshift(arrFib[0] + arrFib[1])
}
let slicedUp = arrFib.slice(1).sort()
for(let j = 0 ; j <= slicedUp.length; j++){
if(slicedUp[j]%2){
addArray = [...addArray,slicedUp[j]]
}
}
return addArray.reduce((a,b) =>{
return (a + b)
});
}
sumFibs(75024);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36
.
Link to the challenge: