A common use case for currying is to create more _________ versions of existing functions.
- Specialized, Generalized, Efficient, Complex
- Efficient, Complex, Generalized, Specialized
- Complex, Generalized, Specialized, Efficient
- Specialized, Efficient, Generalized, Complex
Currying allows the creation of more generalized versions of functions. By partially applying arguments, you can reuse and specialize functions for various scenarios.
Is it possible to declare a variable with let or const in a for-loop and access it outside of the loop?
- Yes, you can access it outside the loop
- No, it's not accessible outside the loop
- Only let variables are accessible
- Only const variables are accessible
Variables declared with let or const in a for-loop are accessible outside of the loop in which they are declared. They have block scope, which means they are confined to the nearest enclosing curly braces, allowing them to be accessed outside the loop.
__________ is a common pattern for dynamically loading modules based on user interactions.
- Lazy Loading
- Eager Loading
- Preloading
- Asynchronous Loading
Lazy loading is a common pattern in which modules are loaded only when they are actually needed, often based on user interactions or certain events, optimizing performance by loading resources on-demand.
Inside a template literal, the expression ${a + b} will __________ the values of a and b.
- Concatenate
- Add
- Multiply
- Evaluate
The expression ${a + b} inside a template literal will evaluate the values of 'a' and 'b'. It performs the specified operation (in this case, addition) and includes the result in the string.
_________ in ES6 Modules enables static analysis and optimization, a feature not present in CommonJS.
- Explicit Dependency Declaration
- Dynamic Dependency Resolution
- Tree Shaking
- Lazy Loading
Tree Shaking in ES6 Modules allows for the removal of unused code during the build process, leading to smaller bundle sizes. This feature is not available in CommonJS, highlighting the advantages of ES6 modules.
When a parameter is declared with a default value, its existence in the function's arguments array will be _________.
- TRUE
- FALSE
- undefined
- nan
When a parameter is declared with a default value, its existence in the function's arguments array will be false. Default parameters do not appear in the arguments object, and accessing them through the arguments object will return undefined.
An ES6 class method can be made private by prefixing its name with __________.
- private
- this
- protected
- underscore
In ES6, a class method can be made private by prefixing its name with an underscore. This convention signals to other developers that the method is intended for internal use and should not be accessed directly from outside the class. While not providing true privacy, it serves as a convention for indicating the method's intended visibility.
When chaining Promises in AJAX calls, what is the purpose of returning another Promise inside a .then() method?
- To allow further chaining of asynchronous operations
- To terminate the Promise chain
- To handle synchronous operations within the Promise
- To trigger a catch block if an error occurs in the Promise chain
In JavaScript, returning a Promise inside a .then() allows for continued chaining of asynchronous operations. This enables better organization and readability of asynchronous code.
When using Object.keys() on an object with Symbol keys, these keys will __________ be included in the returned array.
- always
- sometimes
- never
- based on Object type
When using Object.keys() on an object with Symbol keys, the Symbol keys will never be included in the returned array. This is because Symbol-keyed properties are not enumerable and are ignored by Object.keys().
When calling a static method from another method in the same class, use the class name as a _________.
- reference
- keyword
- identifier
- namespace
In JavaScript, when calling a static method from within the same class, you use the class name as an identifier. This helps differentiate static methods from instance methods, which require an instance of the class.