Skip to content

Commit

Permalink
Merge pull request #289 from muazimmaqbool/master
Browse files Browse the repository at this point in the history
New Question Added
  • Loading branch information
sudheerj authored Jul 5, 2024
2 parents adf2885 + e63b22b commit c6bff48
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@
| 462 | [What is inline caching?](#what-is-inline-caching) |
| 463 | [What are the different ways to execute external scripts?](#what-are-the-different-ways-to-execute-external-scripts) |
| 464 | [How to detect system dark mode in javascript?](#how-to-detect-system-dark-mode-in-javascript) |
| 465 | [What is Lexical Scope?](#what-is-lexical-scope) |
<!-- TOC_END -->

<!-- QUESTIONS_START -->
Expand Down Expand Up @@ -8738,6 +8739,26 @@ The execution context is created when a function is called. The function's code
**[⬆ Back to Top](#table-of-contents)**
465. ### What is Lexical Scope?
Lexical scope is the ability for a function scope to access variables from the parent scope.
<script>
function x(){
var a=10;
function y(){
console.log(a); // will print a , because of lexical scope, it will first look 'a' in
//its local memory space and then in its parent functions memory space
}
y();
}
x();
</script>
**[⬆ Back to Top](#table-of-contents)**
<!-- QUESTIONS_END -->
464. ### How to detect system dark mode in javascript?
The combination of `Window.matchMedia()` utility method along with media query is used to check if the user has selected a dark color scheme in their operating system settings or not. The CSS media query `prefers-color-scheme` needs to be passed to identify system color theme.
Expand Down

0 comments on commit c6bff48

Please sign in to comment.