undefined vs not defined in JS 🤔 | Namaste JavaScript Ep. 6

preview_player
Показать описание
undefined is a special keyword in JavaScript and `undefined !== not defined`. JS is a loosely typed language (weakly typed language). This video covers an in-depth analysis of the undefined keyword and mistakes you should avoid while using this keyword. It is a special keyword in JS and it acts as a placeholder for variables until they are assigned any value in them.

Understand the difference between undefined and not defined in JS. Many developers assume that undefined is exactly the same as not defined, but that's not true. undefined is a value in JavaScript and in fact, it also takes up memory space. So watch this video to understand everything in deep.

Topics Covered:
00:00 - Introduction to undefined in JavaScript
00:29 - Code Example of undefined in JS
02:02 - Code Example of not defined in JS
04:33 - undefined vs not defined demo using code
07:46 - JS is a loosely typed language a.k.a weakly typed language
08:42 - Mistake you should not make while using undefined
10:17 - Teaser of next video - The Scope Chain
10:30 - Thank you for watching Namaste JavaScript 🙏

Support this video series, NOT BY MONEY, but by sharing it with your friends. 🙏
I'll give my best to come up with great content and everything absolutely for free on YouTube. 😊

If you are active on Social Media,
please give a shoutout to Namaste JavaScript and help me reach more people. 🙏

Cheers,
Akshay Saini

Would love to Stay Connected with you ❤️

#NamasteJS #AkshaySaini
Рекомендации по теме
Комментарии
Автор

Summary

1. Undefined is like a placeholder till a variable is not assigned a value.
2. undefined !== not defined
3. JS- weakly typed language since it doesn't depend on data type declarations.

avikkundu
Автор

Summary 📝📝

1.Undefined is a Special Placeholder which is used to reserve memory for the variables in the memory creation phase. Even before a single line of code is executed JS engine assigns undefined to the variables.

2.Not Defined means if we try to console or access any variable which is not declared in the code then we get Not Defined error.

3. JS is a loosely typed language or weakly typed language means it does not attaches its variables to specific data types like in C++ and java.

4.Remember undefined !== not defined.

yashpaota
Автор

How was the video? Are you feeling excited? Please comment below. ❤️

akshaymarch
Автор

I am a 10 Years experienced Sr. Software Engineer. I don't know JavaScript is this much beautiful before watching your Thank you for all your awesome efforts @Akshy Saini. Please do continue your knowledge contribution to the world. It helps a lot to grow....

SrinubabuRavilla
Автор

Others: [Netflix Series, Prime Series, Hotstar Series],
Me: "Namaste 🙏 JavaScript"

jayjani
Автор

Interviewer: Asked anything related to Javascript....
Me: Execution Context !!!

yamansharma
Автор

You will be the man of 2021 for JS lovers. Really nice explanation. Glad I found your channel. Subscribed. 😍👍

ManishSharma-jzhw
Автор

The video covers the following topics:

1)It explains the "undefined" keyword in JavaScript and its role in indicating the absence of a value or the uninitialized state of a variable.
2)The concept of a variable being "not defined" is explored, which refers to a situation where a variable has not been declared or is not accessible in the current scope.
3)The video discusses scenarios where variables are implicitly assigned "undefined" due to hoisting or other factors.
4)It might delve into the difference between "undefined" and "null" in JavaScript and when to use each of these values.
5)The content provides examples and code demonstrations to illustrate the differences and proper usage of "undefined" and "not defined."
6)The video also addresses common programming mistakes or misconceptions related to these concepts.
7)It highlights the importance of understanding the differences between "undefined" and "not defined" to write clean and bug-free JavaScript code.

RITIKSINGH-neev
Автор

1. Undefined is an Special Keyword and Placeholder Which is kept inside the Variable until some Values are not defined to it. It will stay inside the variables if no value is not Assigned.
2. undefined!=not defined, Because undefined means variable is declared but no value is Assigned and not defined means Variable is not even declared.
3. JS is an Loosely Typed Language or Weakly Typed Language, You can Use same variable to store String, Integer, Boolean type Values in same.
Example:
var a;
console.log(a);
a=10;
console.log(a);
a="hello JS";
console.log(a);

moviescrasher
Автор

undefined keyword is like putting a towel for preserving a seat in public transport bus..remember the nice old hack😂

mohammedshamil
Автор

I binge-watched the whole playlist and literally fell in love with JavaScript!
Thanks for the awesome explanation, Akshay :)

MUSICMANHERE
Автор

Binge watched this awesome series. Understood everything! Thank you, Akshay! Craving for the upcoming videos.

vinitraut
Автор

For revision
Undefined: a variable is 'declared', it has its own placeholder but not having the value of itself 'defined' hence 'undefined' and until the variable has assigned a value, the 'undefined' fills that particular placeholder
and 'undefined' is itself a datatype
(really sorry for referencing with c++ concepts)

Not Defined: This case comes in error where js engine neither find that particular variable nor its placeholder
and cannot find the variable in 1st phase of context (Memory allocation context)

and yes "flexibly typed language" sound pretty good instead of "weakly typed language"

xFOXHOUND
Автор

This playlist is hope for every JS lover, please dont stop making the videos they are awesome

sahilbhola
Автор

Thank you for this amazing video.

Summary:
When you have declared a variable and not initialized it, then during the memory allocation phase, this variable will be assigned with undefined.
So, undefined is like a placeholder that is kept for the time being, until a value is assigned to the variable.
It states that the variable is not assigned with anything.

JS is a loosely typed language as you don't need to define whether it is a string or a number or a boolean. It doesn't attach the variable to any particular data type.

chandanmishra
Автор

Every student must learnt every concept from behind the scenes ....I am very luck that I found you earlier

universal
Автор

The ending tune of the video just hits the vibe which no other educational programming video on youtube hits

harshagarwal
Автор

Glad to land to this playlist! Literally the most complex parts are taught with so ease!please bring more videos ❤️

shreyasingh
Автор

This is truly a fantastic video series about JavaScript. I'm impressed with your charisma and enthusiasm for the subject matter. I've learned all this in the past, but it was more complex and time-consuming. You have managed to break it down into short bite-sized lessons that most people can understand and get excited about. Great job!

fusehenry
Автор

Being a Mechanical Engineer I always thought I will never understand these things .
Mentor like you is blessing...
Simply great

adityakatare