(14 hours total, not in a day!) I'm not just winging it either, I have seen people do it in 4 lines and I have around 22ish
I feel kind of, like coding isn't for me, but at the same time know it's for me... It's kind of weird I'm burnt out for the day, and it's really hard for me to accept that I have to wait another day to regain my focus... Right now my brain is refusing to work, and I swear I can be really hard on myself.
I'm doing the Angela Yu Web bootcamp for reference, for someone who knows what it's like, is it supposed to take this long?
I forgot to back it up, so this is a slightly older version, but the version I had worked up to 4 with massive ugly if else statements, but when it went to 5 it would reset the array back down to 1 and print a stand alone 4 (I'm not looking for answers I just need someone to agree with me that they made it and it was this hard for them too) making the code 8 or something just made the array reset and spam 4 4 4 4 4 4 4 4 4 4, my focus was depleted at this point.
var output = [] // No math needs to be done here.
var initial = 0
var initial1 = 1
function fibonacci(chonk) {
if (chonk === 1) {
output.push(initial)
console.log(output) // 0
} else if (chonk === 2) {
output.push(initial)
output.push(initial1)
console.log(output) // 0, 1
} else if (chonk === 3) {
output.push(initial)
output.push(initial1)
output.push(initial1)
console.log(output) // 0, 1, 1
for (var i = 4; chonk >= i; i++) {
output.push(initial1 + initial1)
console.log(output)
}
}
}
fibonacci(4)