Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function numberPyramid(input) {
- let num = Number(input[0]);
- let counter = 1;
- for (let row = 1; row <= num && counter <= num; row++) {
- let current = "";
- for (let col = 1; col <= row && counter <= num; col++) {
- current += counter + " ";
- counter++;
- }
- console.log(current);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement