Skip to content

Commit 7597a64

Browse files
committed
hw
1 parent 3d006f0 commit 7597a64

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1-
// create an array variable containing the names
1+
2+
const input = require('readline-sync');
23

3-
// write a for loop that prints each name on a different line
4+
let num = input.question('Please enter a positive number:');
5+
num = Number(num);
6+
7+
while (num <= 0) {
8+
num = input.question('Invalid input. Please enter a positive number:');
9+
num = Number(num);
10+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
// Create a string variable containing your name.
2+
let name= "Gerardo";
23

4+
for (let i= 0; i < name.length; i++) {
5+
console.log(name[i]);
6+
}
37

48
// Write a for loop that prints each character in your name on a different line.

loops/chapter-examples/package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)