🚀 Mastering JavaScript: let, var, and const! 🚀 #coding #codewithkg

preview_player
Показать описание
Unlock the secrets of JavaScript with a deep dive into let, var, and const! Enhance your coding skills and write cleaner, more efficient code. 🔥 #JavaScript #CodingTips #WebDevelopment

#JavaScript #CodingTips #WebDevelopment #LearnToCode #Programming #TechTutorials #CodeSmart #codewithkg
Рекомендации по теме
Комментарии
Автор

variables declared with let and const in JavaScript are hoisted. However, unlike variables declared with var, they are not initialized with a default value (undefined) during the hoisting process.Instead, let and const variables enter a "temporal dead zone" (TDZ) from the start of the block until the declaration is encountered. Accessing the variable in this TDZ will result in a ReferenceError. This behavior ensures that you cannot access let and const variables before they are declared in the code.Here's an example to illustrate this:console.log(a); // ReferenceError: Cannot access 'a' before initialization
let a = 10;

console.log(b); // ReferenceError: Cannot access 'b' before initialization
const b = 20;In contrast, a variable declared with var would be hoisted and initialized to undefined:console.log(c); // undefined
var c = 30;So, while let and const are hoisted, they behave differently compared to var due to the temporal dead zone and the lack of automatic initialization.

SaiKumar-tgct
Автор

Just wanted to correct you. Let and const also hoisted, but the variables declared will be in temporial dead zone so we can't access it.

kingsgaming
Автор

Python kuda meeru explain chesthe, memu chala happy ga feel avtham anna

rambypilla
Автор

Bro console or output youtube shorts description over flow aithundhe, proper ga kanipistha ledhu bro ...

Any suggestions

Sampathyemjala
Автор

Heloo anna btech lo cse cyber security thiskunte ella untadhi ante cybersecurity jobs placements bagga untaya anf scope enti?.

x.__applex.__
Автор

console.log(x); //var variable
console.log(y); // Reference error

MuraliKrishna-dtxq
Автор

Var variable
Reference error: y is not defined

sairamkaviti