You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: data/blog/ace-the-javascript-interview.mdx
+14-9Lines changed: 14 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -266,8 +266,9 @@ below.
266
266
<divid="hoisting">
267
267
<StepLargeCustomnumber="3"title="Hoisting" />
268
268
</div>
269
+
269
270
> Hoisting is a mechanism of JavaScript where variables and function declarations
270
-
are moved to the top of their scope before code execution.
271
+
> are moved to the top of their scope before code execution.
271
272
272
273
No matter where the function and variables are declared, they are moved at <HighlightBox>the top of their scope</HighlightBox> whether their scope is global or local.
273
274
@@ -351,9 +352,10 @@ In more precise terms: <HighlightBox>== converts both the values to the same typ
351
352
<divid="this-keyword">
352
353
<StepLargeCustomnumber="5"title="this Keyword" />
353
354
</div>
355
+
354
356
> The `this` keyword references the object of which the function is a property of.
355
-
In simple words, the `this` keyword references the object that is currently calling
356
-
the function
357
+
> In simple words, the `this` keyword references the object that is currently calling
358
+
> the function
357
359
358
360
<HighlightBox>Example:</HighlightBox>
359
361
@@ -565,8 +567,9 @@ In the above question:
565
567
<divid="polyfills">
566
568
<StepLargeCustomnumber="9"title="Polyfills" />
567
569
</div>
570
+
568
571
> A polyfill is a piece of code (usually JavaScript on the Web) used to provide modern
569
-
functionality on older browsers that do not natively support it.
572
+
> functionality on older browsers that do not natively support it.
570
573
571
574
For Example, The interviewer might ask you to implement your own `text-shadow` from scratch property or some property which is not supported by old browsers.
572
575
@@ -837,10 +840,11 @@ apiCall();
837
840
<divid="closures">
838
841
<StepLargeCustomnumber="13"title="Closures" />
839
842
</div>
843
+
840
844
> A closure is the combination of a function bundled together (enclosed) with references
841
-
to its surrounding state (the lexical environment). In other words, a closure gives
842
-
you access to an outer function’s scope from an inner function. In JavaScript, closures
843
-
are created every time a function is created, at function creation time.
845
+
> to its surrounding state (the lexical environment). In other words, a closure gives
846
+
> you access to an outer function’s scope from an inner function. In JavaScript, closures
847
+
> are created every time a function is created, at function creation time.
844
848
845
849
Before undersanding closures, lets understand <HighlightBox>Lexical Scope</HighlightBox>
846
850
@@ -889,9 +893,10 @@ The instance of displayName maintains a reference to its lexical environment, wi
889
893
<divid="prototypes">
890
894
<StepLargeCustomnumber="14"title="Prototypes" />
891
895
</div>
896
+
892
897
> JavaScript is often described as a prototype-based language — to provide inheritance,
893
-
objects can have a prototype object, which acts as a template object that it inherits
894
-
methods and properties from.
898
+
> objects can have a prototype object, which acts as a template object that it inherits
899
+
> methods and properties from.
895
900
896
901
Javascript implicitly / internally puts the `__proto__` object. When we craete anything like a function or an object, Javascript add the **proto** object to it with properties and methods.
0 commit comments