forked from Asabeneh/JavaScript-for-Everyone
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path04-string_interpolation.js
More file actions
28 lines (26 loc) · 821 Bytes
/
04-string_interpolation.js
File metadata and controls
28 lines (26 loc) · 821 Bytes
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
let firstName = 'Asabeneh';
let letlastName = 'Yetayeh';
let age = 200; // number data type
let country = 'Finland';
let job = 'teacher';
let lang = 'JavaScript';
let personInfo = `I am ${fullName}.I am a ${age} years old. I am a ${job} and I love teaching.
I live in ${country}.`; //ES6 - String interpolation method
console.log(personInfo);
let numberOne = 10;
let numberTwo = 90;
console.log(
`The sum of ${numberOne} and ${numberTwo} is ${numberOne + numberTwo}.`
);
//More Examples
let gravity = 9.81;
let boilingPoint = 100;
let bodyTemp = 37;
/*
The boiling point of water is 100 oC.
Human body temperatue is 37 oC.
The gravity of earth is 9.81 m/s2.
*/
console.log(
`The boiling point of water is ${boilingPoint} oC.\nHuman body temperatue is ${body} oC.\nThe gravity of earth is ${gravity} m / s2.`
);