Skip to content
Advertisement

How do i loop over a geometric sequence. i need to loop some function over 1, 2, 4, 8, 16

My code is

JavaScript

This is what the program looks like

Advertisement

Answer

With generators:

JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement