From df724cd75e93dc0897b7311d1695fb9481a74094 Mon Sep 17 00:00:00 2001 From: Kola Prabhas <104453116+Kola-Prabhas@users.noreply.github.com> Date: Wed, 31 May 2023 20:10:46 +0530 Subject: [PATCH] Updated script.js in Intro To Javascript I have updated the script.js file in Into To Javascript sections. Now it covers brief history of javascript and gives good information about variable declaration in javascript --- .../1. Introduction To Javascript/script.js | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/learnjs/1. Introduction To Javascript/script.js b/learnjs/1. Introduction To Javascript/script.js index 9558d11..a881709 100644 --- a/learnjs/1. Introduction To Javascript/script.js +++ b/learnjs/1. Introduction To Javascript/script.js @@ -1,17 +1,25 @@ -let c = 12; -let d = 13; +/* Javascript is developed in 1995 by Brendan Eich to make the web pages live. It is first named Livescript and then renamed to Javascript as java was popular at that time +That's a quick history about javascript. Let's know know how to declare variables in javascript. -let age = 26; // initialisation +In javascript variables can be declared using three keywords. They are: + 1. let + 2. const + 3. var + + let and var: + There is very less difference between let and var. var is used in olden days but you can use let to declare variables. -const name = 'Anuj'; -const Name = "kumar"; + const: + Variables declare using const keyword can't be changed once they are assigned a value. So we must assign a value while declaring a variable using const + + */ -// console.log('age', age) -// age = 28; +let name = "John Alec"; +const age = 20; -// console.log("c+d is", c + d); - -// console.log('age', age) -console.log('name', name); +name = "Harry" // No error +age = 34 // Error + +