-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path6-Day.js
More file actions
22 lines (21 loc) · 739 Bytes
/
6-Day.js
File metadata and controls
22 lines (21 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Define a function that takes a number parameter
function checkNumber(number) {
// Check if the number is positive
if (number > 0) {
console.log(`${number} is positive`);
}
// Check if the number is negative
else if (number < 0) {
console.log(`${number} is negative`);
}
// If neither of the above conditions are met, the number must be zero
else {
console.log(`${number} is zero`);
}
}
// Call the function with various test cases to see the output
checkNumber(10); // Output: "10 is positive"
checkNumber(-5); // Output: "-5 is negative"
checkNumber(0); // Output: "0 is zero"
checkNumber(1); // Output: "1 is positive"
checkNumber(-1); // Output: "-1 is negative"