top of page
JS01 - Values - Types - Operators
Complete the following exercises in your javascript file. Specific instructions on how to set are are covered in class.
Exercise 1
// PART 1: CREATE YOUR OWN VALUES
// Write expressions using comparison operators that evaluate to:
// Example:
let example = 5 > 3; // evaluates to true
// YOUR TURN:
// - Create a true comparison between two numbers
// - Create a false comparison between two strings
// - Create a true logical AND expression
// - Create a false logical OR expression
// PART 2: Use these GIVEN values:
let age = 20;
let hasLicense = true;
let hasCar = false;
// Create expressions to check:
// - If someone is old enough to drive (16 or older)
// - If someone can legally drive (old enough AND has license)
// - If someone needs a ride (can legally drive BUT doesn't have a car)
// PART 3: CREATE YOUR OWN SCENARIO
// Create at least two variables and use them in a complex boolean expression
// Example scenario: checking if a student passes a course
// Document your scenario in commentsExercise 2
// INSTRUCTIONS: Create all variables needed unless specified otherwise
// 1. Create three different strings using ', ", and `
// Example:
let myString = 'Hello'; // using single quotes
// YOUR TURN - create two more strings using different quotes
// 2. Use these GIVEN values:
let price = 19.99;
let item = "shirt";
// Create a template literal to output: "The shirt costs $19.99"
// 3. CREATE YOUR OWN values:
// Make a multiline string about your favorite hobby using template literals
// It should include at least two variables you create
// 4. CREATE YOUR OWN values:
// Demonstrate three different ways to combine stringsExercise 3
// PART 1: CREATE YOUR OWN VALUES
// Write expressions using comparison operators that evaluate to:
// Example:
let example = 5 > 3; // evaluates to true
// YOUR TURN:
// - Create a true comparison between two numbers
// - Create a false comparison between two strings
// - Create a true logical AND expression
// - Create a false logical OR expression
// PART 2: Use these GIVEN values:
let age = 20;
let hasLicense = true;
let hasCar = false;
// Create expressions to check:
// - If someone is old enough to drive (16 or older)
// - If someone can legally drive (old enough AND has license)
// - If someone needs a ride (can legally drive BUT doesn't have a car)
// PART 3: CREATE YOUR OWN SCENARIO
// Create at least two variables and use them in a complex boolean expression
// Example scenario: checking if a student passes a course
// Document your scenario in commentsLocked Message
bottom of page
