The code from the Learn JavaScript the Hard Way module JavaScript Level 1 exercises. This is a mirror of the code I have in the book, so if you're struggling you can use this to compare against your attempts.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

19 lines
554 B

// let is the best way to make a variable
let name = 'Zed A. Shaw';
let age = 43;
let height = 74;
// PUZZLE: What happens if you use Math.round?
let feet = Math.floor(height / 12);
let inches = height - (feet * 12);
// you can use a variable as a parameter
console.log("Name:", name);
console.log("Age:", age);
// you can also embed variables in strings with ``
console.log(`Height ${feet} feet ${inches} inches.`);
console.log("Age * Height:", age * height);
// you can also put math in the ${} boundaries
console.log(`Age * Feet: ${age * feet}`);