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.
20 lines
554 B
20 lines
554 B
2 years ago
|
// 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}`);
|