repl.it
@MIhm7904/

ProblemSet3

Nodejs

Problem Set 3: Interpolation

fork
loading
Files
  • index.js
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//Use string interpolation to refactor this code.

//const countdownFive = "There are 5 seconds left until liftoff!"

//const countdownFour = "There are 4 seconds left until liftoff!"

//const countdownThree = "There are 3 seconds left until liftoff!"

//const countdownTwo = "There are 2 seconds left until liftoff!"

//const countdownOne = "There is 1 second left until liftoff!"

//const liftOff = "Lift Off!"

let countdownFive = "are 5 seconds"

let countdownFour = "are 4 seconds"

let countdownThree = "are 3 seconds"

let countdownTwo = "are 2 seconds"

let countdownOne = "is 1 second"

const countdownToLiftoff = `There ${countdownOne} left until liftoff!`

const liftoff = "Lift Off!"

console.log(countdownToLiftoff)

console.log(liftoff)

//In your own words, write a brief description of when interpolation can be useful and how it works with variables.

//An interpolation is useful when numerous variables need to be used in the same string.  It allows the code to be more direct and less repetitive.