For Loops with JavaScript

This is a script that uses for loops to print out the numbers 1 through 10 on the first line, the squares of 1 through 10 on the second line (e.g. 1, 4, 9...), the cubes on line three (e.g. 1, 8, 27...), and so on, for ten lines.

[Link to live example]

See the Pen Calculator with JavaScript by Ian Strand (@strandian) on CodePen.



Return to Blog