// Interpolating variables into a string
let myName = 'Andris'
let myCity = 'Budapest'
console.log(`My name is ${myName}. My favorite city is ${myCity}.`) // Writes to console (equal to Python print)
const newVariable = 3.1415 // Makes a new variable which cannot reassigned
// Basic if statement with AND function
let mood = 'sleepy';
let tirednessLevel = 6;
if (mood === 'sleepy' && tirednessLevel > 8){
console.log('time to sleep')
}
else{
console.log('not bed time yet')
}
// Short hand for if statements
let isLocked = false;
if (isLocked) {
console.log('You will need a key to open the door.');
} else {
console.log('You will not need a key to open the door.');
}
// This one does the same as bove, but is much shorter
isLocked ? console.log('You will need a key to open the door.') : console.log('You will not need a key to open the door.')
// Another example with a string value
favoritePhrase === 'Love That!' ? console.log('I love that!') : console.log("I don't love that!");