Defer Attribute : Starts downloading JS in the background will the HTML is being parsed and hence the parsing is done executes the JS
Async Attribute : Starts downloading JS in the background when HTML is being parsed. Once the JS is download stops HTML parsing and executes the JS and then continues parsing of remaining HTML
Async Vs Defer - JavaScript Loading Explanation
HTML Element Attributes
Allows to interact with the attributes that are applied on the elements
Most of the attributes can be directly accessed on the element using the dot operator
Data attributes can be accessed in JS using using querySelector
with the following syntax [<attribute-name>]
New Scope
An new scope can be created any where in JS by wrapping the code in curly brackets
Template Literal Function
The first parameter to the function is all the strings present in the template string
Nullish Coalescing
JS Enumerate Function Equivalent
Debugging
Immediately Invoked Function Expression (IIFE)
JavaScript’s Immediately Invoked Function Expressions
This function gets executed immediately once the script is run
Named IIFEs can be used as normal functions as well
In ES6 with the introduction of block level variables IIFEs are not used that often
Closure
Closure = Function + Its Environment (Variables used by function)
Can be used to emulate private functions
Master the JavaScript Interview: What is a Closure? | by Eric Elliott | JavaScript Scene | Medium