HW 1
%%js
// Step 1: Create an object variable with student details
const student = {
studentName: "Kian", // Replace with your actual name
age: 17, // Replace with your actual age
isStudent: true // Change to false if you are not a student
};
// Step 2: Create variables for favorite song and artist
const favoriteSong = "Happiness is a butterfly"; // Replace with your actual favorite song
const songArtist = "Lana Del Rey"; // Replace with the artist's name
// Function to play the favorite song
function playFavoriteSong() {
console.log(`Now playing ${favoriteSong} by ${songArtist}`);
}
// Step 3: Display the information using console.log()
console.log(`My name is ${Kian}, I am ${17} years old, and it is ${student} that I am a student.`);
playFavoriteSong();
<IPython.core.display.Javascript object>
popcorn 1
%%js
// Step 3: Create a string variable for "gameQuestion"
let gameQuestion = "My favorite video game is ";
// Step 4: Create a variable for "gameAnswer"
let gameAnswer = "Bloodborne"; // Replace with your favorite game
// Step 5: Output to the console
console.log(gameQuestion + gameAnswer);
<IPython.core.display.Javascript object>
popcorn 2
%%js
// Step 2: Create a variable `nullVar` and set it to `null`
let nullVar = null;
// Step 3: Create a variable `undefinedVar` and leave it uninitialized
let undefinedVar;
// Step 4: Create a variable `symbolVar` and set it to a new Symbol with a description
let symbolVar = Symbol("MyUniqueSymbol"); // You can customize the description
// Step 5: Output all three variables to the console
console.log(nullVar); // Output: null
console.log(undefinedVar); // Output: undefined
console.log(symbolVar); // Output: Symbol(MyUniqueSymbol)