Skip to content

Commit f2665f4

Browse files
committed
added notes and deleted speaker option
1 parent 2f1fb03 commit f2665f4

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

lesson_04/dasiaenglish/lesson_04.md

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
```Javascript
22
#Javascript
33

4-
const readline = require(`readline`);
5-
6-
const rl =readline.createInterface({
7-
input: process.stdin,
8-
output: process.stdout
9-
});
10-
114
function findPrimes(numberToCheck) { // A machine that helps find prime numbers
125

136
if (numberToCheck <=1){
@@ -30,15 +23,16 @@ function findPrimes(numberToCheck) { // A machine that helps find prime numbers
3023
}
3124
} //closing the loop of if it is a prime number or not
3225

33-
rl.question(`Enter a number to check if it\'s prime:`, (input)=>{
34-
let number = parseInt(input);
26+
const input = process.argv[2]; // telling the computer to save the 3rd thing you type
3527

36-
if (isNaN(number)) {
37-
console.log("Please enter a valid number.");
28+
let number = parseInt(input); // if it types a word the computer does the math and makes it a number
29+
30+
if (isNaN(number)) { // make sure you type a number
31+
console.log("Please enter a valid number."); // letting the user know you have to type a number
3832
} else {
39-
console.log(findPrimes(number));
33+
console.log(findPrimes(number)); //now the computer can check if it is prime or not
4034
}
41-
});
35+
4236
// credit from Coding with John youtube video https://www.youtube.com/watch?v=I9-3drnfyp0 and Chatgpt for a explanation of things I still might have been confused about
4337
```
4438

0 commit comments

Comments
 (0)