Тёмный
No video :(

Hoisting in JavaScript  

Coder Dost
Подписаться 80 тыс.
Просмотров 75 тыс.
50% 1

Hoisting is a very interesting and weird concept in JavaScript. How to understand it properly, you can check this video.
A detailed video on Hoisting:
• function HOISTING in J...
🤯 Crash Courses (Single Video)
Git/Github Crash Course : bit.ly/3JSA5VT
TypeScript Crash Course : bit.ly/372dZSh
Angular Crash Course : bit.ly/3DoGJR1
Vue JS Crash Course : bit.ly/3uDujRl
Python Crash Course : bit.ly/3Dod7U2
React Router Crash Course : bit.ly/36YfO2i
🧑‍🏫 Full Course Playlists
HTML : bit.ly/36IMq0h
CSS : bit.ly/3LpRQw6
JavaScript : bit.ly/3u049tf
BootStrap : bit.ly/3NA9nDJ
ES 6 : bit.ly/3DvYCh6
DOM Playlist : bit.ly/35nMKB7
ReactJS (Redux & Hooks) : bit.ly/3iMethN
React with TypeScript : bit.ly/3fQjXtF
React Hooks: bit.ly/3Vmh7wV
Redux: bit.ly/3yAIIkl
NodeJS/ExpressJS : bit.ly/35nN6Yt
MongoDB / Mongoose : bit.ly/3qPj0EO
💻 Projects Playlists
MERN Stack Complete Ecommerce : bit.ly/3ymSs0E
Web Design HTML+CSS - Home Page : bit.ly/35nZiIB
Web Design BootStrap - E-Commerce Site : bit.ly/3iPhaz7
React/Redux/Firebase - Todo-App : bit.ly/3DnekL8
🕹 Mini Projects (Single Video)
React - Tic Tac Toe (Redux / Hooks) : bit.ly/3uzLEuy
React - Game of Flag Quiz (Hooks) : bit.ly/3LpTC0e
React - Google Translate Clone (Hooks) : bit.ly/3Lo9xvZ
React - Chat App using Firebase (Hooks) : bit.ly/3wLgymj
Visit our site: coderdost.com
🔴 Full Courses List : coderdost.com/...
🔴 Full Projects List : coderdost.com/...
💾 Source Codes at : github.com/cod...

Опубликовано:

 

5 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 86   
@coderdost
@coderdost Год назад
React JS MasterClass (10 Hour) : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-6l8RWV8D-Yo.html NODE+ EXPRESS+ MONGO MasterClass (12 Hour) : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-ChVE-JbtYbM.html React Interviews : bit.ly/3QAjAln JavaScript Shorts: bit.ly/3XhHRQ1 React Shorts : bit.ly/3VfIrMi
@jayeshtak2530
@jayeshtak2530 6 месяцев назад
Can you please tell which editor is this ?
@ABHISHEK-yi4ix
@ABHISHEK-yi4ix Год назад
The reason is because when we use var then settimeout will point on the same reference memory but in the let case every time a new variable is associated with the settimeout function and it will point on that particular reference memory in let variable
@taahaquraishi7181
@taahaquraishi7181 Год назад
Actually JS doesn't moves around anything. Execution Context has 2phases, creation phase and execution phase. On creation phase JS engine take variables, functions etc. into memory, all variables are assigned to undefined and all functions are saved in the memory with the code inside them. So JS has available that function on the execution phase, when codes run from top to bottom. That's why you can call the function before initalization.
@sureshmakwana8709
@sureshmakwana8709 Год назад
Oh interesting.... Can you please share some references?
@pranjalsrivastava4260
@pranjalsrivastava4260 3 месяца назад
See namaste javascript playlist by Akshay Saini​@@sureshmakwana8709
@littleshorts6969
@littleshorts6969 Год назад
Answer to last question is that *let* and *var* has different scope declaration. Using *var* makes the variable available outside the block of the *for* loop so when we log it inside the *setTimeout* it works like a global variable
@kashifahmed_1995
@kashifahmed_1995 Год назад
Very good example brother. Hoisting occurs within the function too
@pankajpawar2858
@pankajpawar2858 Месяц назад
If function is created with using simply function keyword not a arrow function or if we not assign it in any variable.
@harmanpreetkaur035
@harmanpreetkaur035 10 месяцев назад
Last ka answer may be ki ye ho :- setTimeout ek callback function hai jo asynchronous task hai to jb execution hota hai program ka to 2 types ke stack bnte hai ek main stack jisme sb synchronous task hote hai aur ek side stack jisme asynchronous task ki list hoti hai, asynchronous task tb tk perform ni hote jb tk main stack khali na ho jaye. To last question ke according synchronous task tha loop run krna jitni bar kaha gya hai aur asynchronous task tha y ko print krna. To hr bar loop call hota gya aur asynchronous task side stack Me add hota gya. Aur jb loop stop hua tb tk variable ki value 6 ho chuki thi aur side stack me specified no. Of times console log y ko kiya tha to utni bar current y ki value means 6 print ho gya
@webdev3779
@webdev3779 Год назад
Always love your video you are so explaining every concept in such a way as it your own native language ...just mind blowing
@CS_HimanshuVishwakarma
@CS_HimanshuVishwakarma Год назад
Wo iss liye 1 show Kiya jab function run hua toh global execution context bna and and wo function ke ander dhundta he and usko wo value inside function nhi milti and wo uss function ke lexical environment me check karta he wo print kar deta he
@vishal10471
@vishal10471 Год назад
Please add some more video in this playlist, please sir
@moosarahil2403
@moosarahil2403 Год назад
Because javascript is compile base programming language and compilation is for early error checking and determining of scope of variables when you make a variable using var so first variable value is assign by undefined but when you use var or lat and make function using let or const so the value is uninitialized
@sayyad_faiz_ali
@sayyad_faiz_ali Год назад
Amazing sir You have lots of knowledge about javascript 👏👏
@jaiprakashkhinchi4630
@jaiprakashkhinchi4630 Год назад
Great content brother need more like this
@subhpra
@subhpra 2 месяца назад
A good explanation. Can I know what theme you are using?
@ashishnirvikar5665
@ashishnirvikar5665 Год назад
Var keyword have a Function Scope This mean single variable of i shared acrosss all iteration of the loop
@ghostAlien44
@ghostAlien44 Год назад
Great sir 😀😀 Keep it up
@vijaykumarjee
@vijaykumarjee Год назад
Let has block scope and VAR has global scope that's why it is printing like this
@neerajpurohit1349
@neerajpurohit1349 4 месяца назад
Because let and const can't be hoisted but var can be hoisted
@Aerotk
@Aerotk Год назад
Woahhh! This hoisting trick damnnn
@KamrulHasan-wb3er
@KamrulHasan-wb3er Год назад
wow , ,, very nice ,, need more
@gamezone43
@gamezone43 Год назад
some people don't understand what is top here, top meaning memory allocation before running the code
@coderdost
@coderdost Год назад
Yes. visually assuming Top is mostly a convention.
@king-hacks
@king-hacks Год назад
Matlab Khali declaration hi hoist hota hai na ki initialization 😅 Am I correct ?
@harbhajansingh9882
@harbhajansingh9882 11 месяцев назад
I have also same doubt
@YashTiwari.official
@YashTiwari.official 10 месяцев назад
Only declaration
@youtubespecial6517
@youtubespecial6517 7 месяцев назад
Correct
@cartoonlover6010
@cartoonlover6010 Год назад
Because you write var before for loop
@salmanraza4773
@salmanraza4773 Год назад
Sir can you please made ka full course of javascript
@11O19H1L
@11O19H1L Год назад
Bro just subscribed your channel beginners k liye bhi kuch shorts banao
@coderdost
@coderdost Год назад
We are making beginner videos also, and some of them coming this week. but some videos are advanced as many old subscribers have more knowledge of JS. But please comment topics you have in mind for beginners. So we can have some idea - and work on it Thanks
@WhiteNoiseAtLocation
@WhiteNoiseAtLocation 3 месяца назад
That last one is because of Closure not Hoisting!
@JeetKRamnani
@JeetKRamnani Год назад
Please explain API in next video how does it work what is it
@muhammad_faraz_ali
@muhammad_faraz_ali Год назад
Due to the "closure"
@davidbaraiya2649
@davidbaraiya2649 Год назад
hoisting is dead after ES6 ?
@coderdost
@coderdost Год назад
yes, almost. makes code hard to read. but function hoisting sometimes still used.
@ytkxmemes4315
@ytkxmemes4315 Год назад
Nice 😃
@hridayjyotiborkakati3449
@hridayjyotiborkakati3449 Год назад
How u are getting the result wrt variable Are u using any extension?
@coderdost
@coderdost Год назад
Quokka js
@JeetKRamnani
@JeetKRamnani Год назад
Another how this works with normal function and arrow funxtion
@manishkumarnirala4843
@manishkumarnirala4843 Год назад
Can you tell us which extension you are using for display console or error beside the code
@coderdost
@coderdost Год назад
Quokka js
@niazihub2959
@niazihub2959 8 месяцев назад
ye Text Editor konsa hai ? someone can tell me name of this software
@mrwellknown24
@mrwellknown24 Год назад
How is he getting the outputs there itself am I missing something? I am new to this please tell if anyone knows..
@coderdost
@coderdost Год назад
quokka js plugin
@anujadi8366
@anujadi8366 Год назад
May i pls know which editor r u using its very cool
@coderdost
@coderdost Год назад
VSCODE with dark theme. And some changes in its settings json
@qalbichamp9907
@qalbichamp9907 Год назад
How we can make our setting like this?
@coderdost
@coderdost Год назад
@@qalbichamp9907 I am sharing my settings.json. This you have to put in your setting.json. But it will change many things, so use wisely "workbench.colorCustomizations": { // Totally Transparent "editor.selectionHighlightBackground": "#ffffff00", "editor.findMatchHighlightBackground": "#ffffff00", // Borders "editor.findMatchBorder": "#ffff00", "editor.findMatchHighlightBorder": "#ff0000", "editor.selectionHighlightBorder": "#ffffff", "editor.lineHighlightBorder": "#272727", // Selection "editor.selectionBackground": "#771835", "editor.wordHighlightBackground": "#771835", // Misc "editorCursor.foreground": "#00ff00", "editor.lineHighlightBackground": "#181818", "editor.findMatchBackground": "#000000", // Debugger "statusBar.debuggingBackground": "#410d18", "statusBar.debuggingForeground": "#dddddd" }, "editor.hover.delay": 1000 } "editor.parameterHints": false "editor.hover.enabled: false "editor.lineDecorationsWidth": 0, "editor.glyphMargin": false, "editor.folding": false,
@pushpakrai8847
@pushpakrai8847 Год назад
​@@coderdost wow 🎉
@ganeshmk2652
@ganeshmk2652 Год назад
How to take input in javascript.? Not input from alert notification, from the console.
@coderdost
@coderdost Год назад
Don't know of a way to stop execution and take input in the browser. But you can use NodeJS to run some javascript files.. and provide command line arguments as inputs e.g. node index.js 1 'hello' 2 its will be stored in process.argv like an array so process.argv[2] => 1 process.argv[3] = 'hello' process.argv[4]=2 first 2 element of array will be - 'node' and 'index.js' so I ignored.
@ganeshmk2652
@ganeshmk2652 Год назад
@@coderdostok thankss❤
@MrChhetri
@MrChhetri Год назад
Still using var should be illegal
@ProCoderVivek
@ProCoderVivek Год назад
Visual studio use kar te ho kya sir
@coderdost
@coderdost Год назад
Yes VS code
@HAKrBOY
@HAKrBOY Год назад
Which extension you are using that visualise console log
@coderdost
@coderdost Год назад
Quokka js ru-vid.com_72lLE8uphc
@imsujata546
@imsujata546 Год назад
Recursion??
@kuldeep7063
@kuldeep7063 Год назад
तो फिर इसपर अच्छा-खासा वीडियो बना दे ताकि इसकी बारीकी समझ सके
@coderdost
@coderdost Год назад
Yes. Working on it
@lakhanraut8437
@lakhanraut8437 Год назад
sir subtitle add nahi ho sakta kya english me.. if possible so please sir ...add subtitle in english
@coderdost
@coderdost Год назад
will try. thanks
@SahilKhan-rw9qc
@SahilKhan-rw9qc Год назад
Yh konsa extension hai jo side ms solution show kr deta hai muje bhi btana
@coderdost
@coderdost Год назад
Quokka JS
@SahilKhan-rw9qc
@SahilKhan-rw9qc Год назад
@@coderdost is it free or paid?
@coderdost
@coderdost Год назад
@@SahilKhan-rw9qc free for singlie file. paid for multiple files
@preetikembale980
@preetikembale980 Год назад
which editor do you use?
@coderdost
@coderdost Год назад
VScode with Quokka js extension
@saharsh_30
@saharsh_30 Год назад
bhai thoda slow smjhaya kr
@mdanas0007
@mdanas0007 Год назад
Never use var.
@its_code
@its_code Год назад
Extension name you use for console log
@coderdost
@coderdost Год назад
Quokka js
@its_code
@its_code Год назад
@@coderdost thanks 😊
@dg_official96
@dg_official96 Год назад
var ka nahi samja mere ko
@sourabhsisodia9563
@sourabhsisodia9563 Год назад
var and let works differently. var is hoisted but let is not
@dg_official96
@dg_official96 Год назад
@@sourabhsisodia9563 mere ko lagta hai aur short video espar nikalna chahiye
@coderdost
@coderdost Год назад
More examples coming. Var can be defined anywhere but in compiler- Javascript moves all definition to the top. Top of file in case of global var. OR top of function in case of var in functions( even before first line in function)
@sourabhsisodia9563
@sourabhsisodia9563 Год назад
@@coderdost yaa var is function scoped and let is block scoped
@dg_official96
@dg_official96 Год назад
@@coderdost thankq sir...
@qalbichamp9907
@qalbichamp9907 Год назад
Bro ap ka insta account kia hai
@coderdost
@coderdost Год назад
Not active but search by coderdost
Далее
Learn JavaScript Hoisting In 5 Minutes
5:40
Просмотров 130 тыс.
НЕДОВОЛЬНА УСЛУГОЙ #shorts
00:27
Просмотров 19 тыс.
Cute kitty gadget 💛💕
00:23
Просмотров 4,7 млн
JavaScript LIVE Coding Interview Round (Mock)
18:55
Просмотров 39 тыс.
JavaScript Functions Crash Course
1:36:54
Просмотров 171 тыс.
Closures in JS 🔥 | Namaste JavaScript Episode 10
22:44