Tell us what’s happening:
Below I have my initial idea about how to approach this challenge. I have some suspicions about my approach which I’m calling “weak points”. I would appreciate it if someone would address my concerns as baseless or on track. If you see anything grossly out of order in my approach, then I would appreciate guidance in this matter, but my main desire is to find out if my weak points are valid. Thank you.
I have to perform two different forms of math: that which creates the sequence and that which adds together the odd integers.
a. I have a suspicion that these could be combined into a single sequence under filter - am I mistaken?
b. I have a suspicion that 2. should use a for loop instead, specifying the limit that numbers can be looped through and THEN passing those elements into function that creates the Fibonacci sequence. I feel like a simple if statement is not enough.
- Create empty array
- Use if statement: for all positive integers less than or equal to value of variable num, create alogrithm addition corresponding to fibonacci sequence and push numbers this creates into empty array
- Use filter() to draw odd numbers out of that array that are less than or equal to num
- Add those numbers together
- Return that sum
Thank you again.
Your browser information:
User Agent is:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.81 Safari/537.36.