Fork me on GitHub

Question

1
of 10

JavaScript Quiz

Score

0
points
  • What is CORS?

    • Cross-Origin Resource Sharing
    • Allows restricted resources (e.g. fonts) on a web page to be requested from an outside domain.
    • Allows scripts to interact more openly with content outside of the original domain, leading to better integration between web services.
    • All of the above.
  • What is a static method?

    • A function that exists on an instance, not a class.
    • A method that only takes one argument.
    • A function that exists on a class, not an instance.
    • None of the above.
  • How is let different from var?

    • let is block scoped.
    • let isn't hoisted.
    • let can't be redeclared.
    • All of the above.
  • Which of the following methods can be used to organize/encapsulate code?

    • The module pattern in ES5 or Module Import Export in ES6.
    • An Immediately Invoked Function Expression.
    • OO or Objects Linked to Other Objects
    • All of the above.
  • What are higher order components in React?

    • They're basically wrappers for other components.
    • They take in another component as an argument.
    • They're used to extend or modify the behavior of a wrapped component.
    • All of the above.
  • How do objects inherit methods in JavaScript?

    • With Object.create or Object.setPrototypeOf.
    • With class Sub extends Super in ES2015.
    • Using Parent.prototype.method.call inside Child.prototype.method.
    • All of the above.
  • What does the bind method do?

    • Returns a function that, when executed, will call the original function with a this context that you pass in.
    • Prevents the value of this from being overridden by call or apply.
    • Allows you to implement partial application of a function.
    • All of the above.
  • Which of these is a use case for the bind, call, or apply methods?

    • You can use call or apply to borrow methods from other objects.
    • You can use bind for partial function application.
    • If you're using the map method to run a function on an array and you need to preserve the this context, you can use bind.
    • All of the above.
  • What does the new keyword do?

    • Creates a new empty object.
    • Sets the prototype of the new object to the constructor's prototype and calls the constructor.
    • Sets the this variable to the new object and returns the new object.
    • All of the above.
  • What's an example of a practical use case for recursion?

    • Traversing a tree (e.g., Walking the DOM).
    • Flattening a deeply nested array.
    • Deep freezing a deeply nested object.
    • All of the above.