One of the features that came with ES6 is the addition of let and const, which can be used for variable declaration.
Variable means anything that can vary. In JavaScript, a variable stores the data value that can be changed later on.
Use the reserved keyword var to declare a variable in JavaScript.
let<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Tutor Joes</title> </head> <body> <script src="js/script.js"></script> </body> </html>To download raw file Click Here
/* 1997 var 2015 E6 let const */ /* var a=25; var b=35; console.log(a+b); */ //----------------------------------- //1.Scope /* if(true) { //var msg="Welcome to Tutor Joes"; //let msg="Welcome to Tutor Joes"; const msg="Welcome to Tutor Joes"; //console.log(msg); } console.log(msg); */ //----------------------------------- //2.Variable Redeclaration /* var a=25; console.log(a) var a=45; console.log(a) let a=25; console.log(a) let a=45; const a=25; console.log(a) const a=45; */ //----------------------------------- //3.Value assignment /* var a=25; console.log(a); a=45; console.log(a); */ /* let a=25 console.log(a); a=45; console.log(a); const a=25; console.log(a); a=45; //Constant Error console.log(a); */ const student={'name':"ram","age":12}; console.table(student); console.log(student.name); student.name="Joes"; console.table(student);To download raw file Click Here
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions