News for hackers. Stuff that matters.
Re:Things I Learned Writing a Fibonacci Generator in JavaScript by dvlsg on Tuesday May 17, 2016 @02:38AM (#11711717)
Closures aside, a somewhat significant difference between the two is that the generator would yield each value in the sequence, whereas yours would just return a single value from the sequence. Which might be perfect, depending on the use case, but they're not quite the same.
Re:Things I Learned Writing a Fibonacci Generator in JavaScript by PeCaN on Tuesday May 17, 2016 @03:31PM (#11716596)
No, that would return all of them in sequence via successive calls to the returned function. It's just a ghetto generator anyway.
Re:Things I Learned Writing a Fibonacci Generator in JavaScript by gravypod on Tuesday May 17, 2016 @03:35PM (#11716633)
Please see my response to symbiosis