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
811 B
19 lines
811 B
5 years ago
|
// Declaring different variables of different data types
|
||
|
let space = ' '
|
||
|
let firstName = 'Asabeneh'
|
||
|
let lastName = 'Yetayeh'
|
||
|
let country = 'Finland'
|
||
|
let city = 'Helsinki'
|
||
|
let language = 'JavaScript'
|
||
|
let job = 'teacher'
|
||
|
// Concatenating using addition operator
|
||
|
let fullName = firstName + space + lastName // concatenation, merging two string together.
|
||
|
console.log(fullName)
|
||
|
|
||
|
let personInfoOne = fullName + '. I am ' + age + '. I live in ' + country // ES5
|
||
|
console.log(personInfoOne)
|
||
|
// Concatenation: Template Literals(Template Strings)
|
||
|
let personInfoTwo = `I am ${fullName}. I am ${age}. I live in ${country}.` //ES6 - String interpolation method
|
||
|
let personInfoThree = `I am ${fullName}. I live in ${city}, ${country}. I am a ${job}. I teach ${language}.`
|
||
|
console.log(personInfoTwo)
|
||
|
console.log(personInfoThree)
|