'F' → Fullscreen
console.log("--- Task 1: Increment, Decrement, and Compound Assignment ---");
let score = 10;console.log("Initial score: " + score);
// Compound assignmentscore += 5;console.log("Score after += 5: " + score);
// Increment operatorscore++;console.log("Score after ++: " + score);
// Decrement operatorscore--;console.log("Score after --: " + score);
alert("Press Enter to continue...");// -----------------------------------------------------------------------------//19 collapsed lines
console.log("--- Task 1: Increment, Decrement, and Compound Assignment ---");
let score = 10;console.log("Initial score: " + score);
// Compound assignmentscore += 5;console.log("Score after += 5: " + score);
// Increment operatorscore++;console.log("Score after ++: " + score);
// Decrement operatorscore--;console.log("Score after --: " + score);
alert("Press Enter to continue...");// -----------------------------------------------------------------------------
console.log("--- Task 2: The Math Object and Constants ---");
let radius = 5;
// Calculate area using Math.PI Math.pow()let area = Math.PI * Math.pow(radius, 2);console.log("Area of circle with radius " + radius + ": " + area);
// Generate a random dice roll (1-6)let diceRoll = Math.floor(Math.random() * 6) + 1;console.log("Random dice roll: " + diceRoll);
alert("Press Enter to continue...");// -----------------------------------------------------------------------------//34 collapsed lines
console.log("--- Task 1: Increment, Decrement, and Compound Assignment ---");
let score = 10;console.log("Initial score: " + score);
// Compound assignmentscore += 5;console.log("Score after += 5: " + score);
// Increment operatorscore++;console.log("Score after ++: " + score);
// Decrement operatorscore--;console.log("Score after --: " + score);
alert("Press Enter to continue...");// -----------------------------------------------------------------------------
console.log("--- Task 2: The Math Object and Constants ---");
let radius = 5;
// Calculate area using Math.PI Math.pow()let area = Math.PI * Math.pow(radius, 2);console.log("Area of circle with radius " + radius + ": " + area);
// Generate a random dice roll (1-6)let diceRoll = Math.floor(Math.random() * 6) + 1;console.log("Random dice roll: " + diceRoll);
alert("Press Enter to continue...");// -----------------------------------------------------------------------------
console.log("--- Task 3: Escape Characters ---");
// Using tab (\t) for formattinglet table = "Item\t\tPrice\nKeyboard\t$75\nMouse\t\t$25";console.log(table);
// Using newline (\n) and quotes (\")let message = "He said, \"Hello, world!\"\nAnd the program responded, 'Hi.'";console.log(message);
alert("Press Enter to continue...");// -----------------------------------------------------------------------------//47 collapsed lines
console.log("--- Task 1: Increment, Decrement, and Compound Assignment ---");
let score = 10;console.log("Initial score: " + score);
// Compound assignmentscore += 5;console.log("Score after += 5: " + score);
// Increment operatorscore++;console.log("Score after ++: " + score);
// Decrement operatorscore--;console.log("Score after --: " + score);
alert("Press Enter to continue...");// -----------------------------------------------------------------------------
console.log("--- Task 2: The Math Object and Constants ---");
let radius = 5;
// Calculate area using Math.PI Math.pow()let area = Math.PI * Math.pow(radius, 2);console.log("Area of circle with radius " + radius + ": " + area);
// Generate a random dice roll (1-6)let diceRoll = Math.floor(Math.random() * 6) + 1;console.log("Random dice roll: " + diceRoll);
alert("Press Enter to continue...");// -----------------------------------------------------------------------------
console.log("--- Task 3: Escape Characters ---");
// Using tab (\t) for formattinglet table = "Item\t\tPrice\nKeyboard\t$75\nMouse\t\t$25";console.log(table);
// Using newline (\n) and quotes (\")let message = "He said, \"Hello, world!\"\nAnd the program responded, 'Hi.'";console.log(message);
alert("Press Enter to continue...");// -----------------------------------------------------------------------------
console.log("--- Task 4: Challenge Task (Combining Concepts) ---");
let totalStudents = 15;const GRADE_INCREASE = 1.05;let newGrade = 80;
// Compound assignment with a constantnewGrade *= GRADE_INCREASE;
// Round the grade using Math.round()let roundedGrade = Math.round(newGrade);
console.log(`Out of ${totalStudents} students,`);console.log(`the new rounded grade is: ${roundedGrade}.`);//Your program output should something similar to the sample output below.
--- Task 1: Increment, Decrement, and Compound Assignment ---Initial score: 10Score after += 5: 15Score after ++: 16Score after --: 15Press Enter to continue... [Enter]--- Task 2: The Math Object and Constants ---Area of circle with radius 5: 78.53981633974483Random dice roll: 6Press Enter to continue... [Enter]--- Task 3: Escape Characters ---Item PriceKeyboard $75Mouse $25He said, "Hello, world!"And the program responded, 'Hi.'Press Enter to continue... [Enter]--- Task 4: Challenge Task (Combining Concepts) ---Out of 15 students,the new rounded grade is: 84.You may write your reflection answers as comments at the bottom of your code.
Submit your activity and reflection answers to the appropriate dropbox.