Created
August 22, 2020 12:06
-
-
Save iamsaief/c27d862a805a915652e1452fda95bc50 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* let, const */ | |
let gf = "Jennifer Lawrence"; | |
console.log(gf); | |
gf = "Elizabeth Olsen"; | |
console.log(gf); | |
/** | |
* Output : | |
Jennifer Lawrence | |
Elizabeth Olsen | |
*/ | |
const username = "willsmith"; | |
username = "jhonshow"; //TypeError: Assignment to constant variable. | |
const number = [1, 2, 3, 4, 5]; | |
number[1] = 10; | |
number.push(6); | |
console.log(number); | |
// Output: [ 1, 10, 3, 4, 5, 6 ] | |
const user = { name: "Shakib", age: 30 }; | |
user.name = "Mushfiq"; | |
user.profession = "Cricker"; | |
console.log(user); | |
// Output: { name: 'Mushfiq', age: 30, profession: 'Cricker' } | |
/* Block Scope */ | |
let sum = 0; | |
for (let i = 0; i < 5; i++) { | |
sum += i; | |
} | |
console.log(sum); // 10 | |
console.log(i); | |
//ReferenceError: i is not defined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment