This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <title>Food Munch</title> | |
| <!-- Font Awesome (icons only, no JS dependency) --> | |
| <script src="https://kit.fontawesome.com/d1c2ea8b80.js" crossorigin="anonymous"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| console.log(A); | |
| console.log("this code works"); | |
| var A = 10; | |
| // In general we know that after initialization and declaration a variable only we can print it. | |
| // but if we observe the above code we are using 'A' before its initialization so code should break but it still works without error. | |
| // But how does the code works? the answer is due to 'Hoisting' as it means we initialized the variable using 'var' which makes the variable used before declaration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Design patterns in frontend development, as in other areas of software development, are reusable solutions to common problems. They provide a structured way to solve problems while promoting code maintainability, scalability, and readability. Here are some popular design patterns used in frontend development: | |
| 1. **MVC (Model-View-Controller):** While commonly associated with backend development, MVC can be applied to frontend applications as well. Models represent data, Views handle presentation and UI logic, and Controllers manage user interactions. | |
| 2. **MVVM (Model-View-ViewModel):** This pattern separates concerns by introducing a ViewModel between the Model and View. It's often used in frameworks like Angular and Knockout.js. | |
| 3. **Observer:** The Observer pattern allows objects (observers) to subscribe to changes in another object (subject) and be notified when changes occur. It's useful for implementing event handling in user interfaces. | |
| 4. **Singleton:** The Singleton pattern ensures that a class ha |