JavaScript ES6 / ES2015 - [03] Let and Const Declaration

preview_player
Показать описание
In this video Ill show you how to start using the let and const declaration for setting variables and constants

SUPPORT THIS CHANNEL WITH A CUP OF COFFEE PER MONTH:

ONE TIME DONATIONS:
Рекомендации по теме
Комментарии
Автор

4:14 "We get an error. That was not supposed to happen". I want this on a T-shirt.

ParasBansal
Автор

Thank you for the videos on ES6. This was very helpful in understanding Let. I liked it enough that I went over to Udemy and bought your new JavaScript Course : )

TheologicalQuest
Автор

use [ctrl + / ], to comment any selected lines in atom
best use case when studying js, u write many small test functions in js, which u might need to study again, hence my fav
select all [ ctrl + A ]
comment [ ctrl + / ],
atom changed my life

neetishraj
Автор

is const the same as let in general/block level scope? Can i define an array as const outside a loop, for example, and push values into it only inside the loop?

rafaeljm
Автор

That WIX advertisement is depressing to watch under this context, because it makes me feel like whatever I've learnt here won't matter. "You need a website? Why not build it yourself (with our AI designer, instead of hiring a "pricey" human)?"

mrvzhao
Автор

Now that we have 'let', do you recommend we stop using 'var' for all future work?

TT-udgf
Автор

Hello Keep up the good work! I was wondering should i use sublime or atom?

michaelguest
Автор

let x = [];
console.log(x);
x = []; // throws error....

So it is assignment to a const is throwing error. Even if its the same thing we are assigning.

Conclusion: Assignment to a const should be only once.

Correct me if I am wrong.

nitinkumar_nagamalla
Автор

hi sir,

I have code like this
let a= { name:"scott"};
a.name = "john";
console.log(a);
now name is john. If I use const keyword we are changing 'a' value. How we can prevent the changing of value.

kondasomu
Автор

I have one doubt in const.. if we declare variable with const we wont be able to change the value then why am i able to pop the value from const array.. Please provide the clarification..

JD-srdm
Автор

Hiii bro
Small doubt
Exapmle: const numOne=5;
Const numTwo= 6;
Console.log (numOne > numTwo)
Tell me answer bro

kalaiselvam
Автор

Is it good idea to assign constants to mutable objects? Isn't the entire idea of a constant that it's... constant?

micycle
Автор

What is the reason for having to "scripts"? So, when we run a "npm run build", which one is executed?

mohsenmadi
Автор

this is what i needed, was finding them difficult to understand why people use let and what is const etc...

pizza
Автор

Well, I'm confused with let. I thought the scope worked fine, with let it's the opposite for me.

proevilz
Автор

Why should I use the same variable name in different scopes? For me it seems a little bit confusing and the code is not so clear.

groovebird
Автор

let and const screw up "this" binding as well. If you say something like

var a = 5;
function logMe() {console.log(this.a)};
logMe();

in the old syntax, this would work and log 5. But if you try declaring the variable with let or const, it returns undefined. I get why ES6 is technically better, but differences like this are annoying

JeremyGalloway
Автор

in the global scope let and const aren't the same!
you can repeatedly declare the same variable in the same scope as much as you want using "var" keyword, BUT you can't do that using "let". you are too far from knowing what you are doing. you haven't mentioned anything about enclosing scopes nor execution contexts. and about const means it doesn't allow a new assignment but you can change the whole content of the array by pushing or popping what's in there.

medi
Автор

cant concentrate with your keyboard crunching in my ears..

kodieivie