Let's redefine the "undefined". Can we do it in JavaScript?
⇩
➊ What is "undefined"?
❑ "undefined" is a variable in the global scope. The value of "undefined" is the primitive value "undefined"
❒ When a variable is declared but not assigned any value, value of global variable "undefined" is assigned to it implicitly.
➋ "undefined" is not a reserved keyword
❑ It means you can declare a variable named "undefined".
❒ So, what will happen if you declare a variable called "undefined" and assign some other value to it?
Let's explore.
➌ Redefining "undefined": Part 1
❑ We already said, "undefined" is a variable in the global scope.
❒ So, you can't declare another variable named "undefined" in the global scope.
➍ Redefining "undefined": Part 2
❑ You can declare a variable named "undefined" in a function or, block. That's allowed.
❒ And as you might have suspected, we lost access to "undefined" in global scope.
❑ You can access it using "window.undefined".
💭 Final Words
❑ "undefined" is not a reserved keyword. Hence you can redefine it, but not in global scope.
❒ Though it's allowed, we should avoid doing it. It will pollute the code. Consider this as a BAD PRACTICE.
End of 🧵
Are you learning JavaScript? Or, a strong JavaScript enthusiast? I have been sharing interesting and useful threads and infographics on JavaScript. Check my "Moments" section for more.
To never miss any future contents, Follow Me ✅
• • •
Missing some Tweet in this thread? You can try to
force a refresh
✧ Interesting details about inline & block-level
✧ Link to high resolution image
⇩
📋 Table of Contents
➊ Introduction
➋ inline-level
➌ block-level
➍ Changing Element Level
➎ List of inline-level elements
➏ List of block-level elements
➐ Link to High Resolution Image
🚥 Disclaimer
❑ I have compiled these information with all sincerity. But in case you find any omissions or, wrong representations, 💬 me.
❒ If you have any suggestions or, feedbacks, share those with me. I am eager to hear from you.
➊ What is Semantic HTML?
➋ Examples of Semantic Elements
➌ Benefits of using Semantic HTML
➌.➀ Improve site's SEO positioning
➌.➁ Help your site more accessible
➌.➂ Closer to natural language, easier to maintain
➍ Should we not use "div"?
➊ What is Semantic HTML?
❏ Semantic HTML adds essential meaning to the web page rather than just presentation.
❐ This lets web browsers, search engines, screen readers, RSS readers, and ultimately users understand it in a better way.
➊ Static Methods
➋ Accepts -ve Index
➌ Returns Boolean
➍ Returns Index
➎ Returns new Array
➏ Modifies Existing Array
➐ Iterates through entire Array
➑ Iterates Partially
➒ Checks Elements "as it is"
➓ Checks Elements custom way
➊➊ Accepts a callback