This exam was designed for fun, and should not be taken completely seriously as a legitimate testing source. It is also brand-new and needs to be tested more thoroughly. I appreciate your understanding! It can be difficult to understand how skilled you are at a particular subject. Standardized exams such as this provide a method of comparison to help reveal your place. It can be taken again a few months later as you learn and get better, which can help you understand how much you are progressing in skill each time. Designed as a tool to assess a JavaScript developer's aptitude, The JavaScript Exam comprehensively evaluates knowledge across a wide range of understanding, differentiating certain levels of knowledge and skill with precision. It assesses both general knowledge about JavaScript and a developer's ability to work with it in order to solve problems, and attempts to offer a thorough (lengthy 100-point) examination of skill level.
Your answers are automatically saved locally in case you accidentally quit out. The timer stops if the exam page is not open, so you can take it in parts and finish it at a later time. What Most People Say: “I can hide variables within an anonymous JavaScript function.”
What You Should Say: “Static scoping is based on the lexical scope model, and relies on variable declarations and function closures. Static scoping is fixed at the time you write the code, and can usually be optimized by the JS engine. Dynamic scoping with the ‘this’ keyword is based on run-time conditions. It may be less performance-optimized, but the flexibility of sharing the function across different contexts can be useful. Sometimes the predictability of static scoping is more preferable, and sometimes the flexibility of ‘this’ scoping is more what you want.”
Why You Should Say It: Being able to explain how a language works shows that you’re an experienced developer who possesses in-depth knowledge of a tool. The lexical scoping model and the dynamic ‘this’ model are at the very heart of JS, and any good JS developer knows how to navigate both mechanisms and properly make the tradeoffs.
What is function closure? What are some ways that closure can be used to maintain state? What Most People Say: “Closure is about callbacks. Setting a timeout is an example of closure.”
What You Should Say: “Closure is how a function is able to remember the variables in its enclosing scope when it runs later in a different scope. For example, when I pass a function to an event handler or Ajax call, and its surrounding variables later when the event fires to remember its context. That’s an example of the function closure maintaining state.”
Why You Should Say It: Closure describes how a function maintains access to the scope of surrounding variables. It is one of the most foundational aspects of the language, and is used in many different contexts, including functional programming. JavaScript is a programming language that started off simply as a mechanism to add logic and interactivity to an otherwise static Netscape browser. In the years since its introduction, it has not only supplanted a variety of other competing languages and technologies to become the standard for browser-based programming, but it has also expanded beyond the client space to become a dominant language on the server side, as well. What You Should Say: “Functional programming relies on closure to maintain state instead of side effects on surrounding variables. This lets you perform operations on values in a more predictable way.”
Why You Should Say It: Closure is one of the building blocks of functional programming, and JS’s ability to mix procedural and OO concepts with the power of functional programming is its most unique and important language design characteristic. This powerful combination gives developers many more tools to solve problems.