hw8
popcorn 1
%%js
let isMonday = false;
let completedChores = true;
let isRaining = true;
console.log("Is today Monday? " + isMonday); // This will print "Is today Monday? false"
console.log("Have you completed your chores? " + completedChores); // This will print "Have you completed your chores? true"
console.log("Is it raining outside? " + isRaining); // This will print "Is it raining outside? ture"
popcorn 2
%%js
// Step 1: Declare a boolean variable
let isStudent = false; // Change to false to test different scenarios
// Step 2: Use the boolean in a condition
if (isStudent) {
// Log a message for the true condition
console.log("Welcome, student!");
} else {
// Log a message for the false condition
console.log("Welcome, guest!");
}
popcorn 3
%%js
// Declare variables
const userName = "Bloodborne";
let gpa = 5.0; // Student's GPA
let inExtracurriculars = true; // Participation in extracurricular activities
// Determine eligibility using boolean operators
const isEligibleForScholarship = (gpa >= 4.5) && inExtracurriculars;
// Log the result
if (isEligibleForScholarship) {
console.log("Congratulations, " + userName + "! You are eligible for the scholarship.");
} else {
console.log("Keep working hard to meet the eligibility criteria, " + userName + ".");
}
%%js
// Popcorn hack
// Open Devolper Tools
// Help --> Devolper Tools
// Change the variables so you get 4 Correct
let a = false;
let b = true;
let c = false;
let d = false;
if (Boolean(a) == false) {
console.log("A = Correct");
} else {
console.log("A = InCorrect");
}
if (Boolean(b) != false) {
console.log("B = Correct");
} else {
console.log("B = Incorrect");
}
if (Boolean(c) != true) {
console.log("C = Correct");
} else {
console.log("C = Incorrect");
}
if (Boolean(d) == true) {
console.log("D = Correct");
} else {
console.log("D = incorrect");
}
if (Boolean(a) == false && )