10 Interview Questions Every JavaScript Developer Should Know AKA: The Keys to JavaScript Mastery



https://medium.com/javascript-scene/10-interview-questions-every-javascript-developer-should-know-6fa6bdf5ad95

1. Can you name two programming paradigms important for JavaScript app developers?
Prototypal inheritance (also: prototypes, OLOO).
Functional programming (also: closures, first class functions, lambdas).


What is functional programming?
Pure functions / function purity.
Avoid side-effects.
Simple function composition.
Examples of functional languages: Lisp, ML, Haskell, Erlang, Clojure, Elm, F Sharp, OCaml, etc…
Mention of features that support FP: first-class functions, higher order functions, functions as arguments/values.

What is the difference between classical inheritance and prototypal inheritance?
Classes: create tight coupling or hierarchies/taxonomies.
Prototypes: mentions of concatenative inheritance, prototype delegation, functional inheritance, object composition.

4. What are the pros and cons of functional programming vs object-oriented programming?

Good to hear:

Mentions of trouble with shared state, different things competing for the same resources, etc…
Awareness of FP’s capability to radically simplify many applications.
Awareness of the differences in learning curves.
Articulation of side-effects and how they impact program maintainability.
Awareness that a highly functional codebase can have a steep learning curve.
Awareness that a highly OOP codebase can be extremely resistant to change and very brittle compared to an equivalent FP codebase.
Awareness that immutability gives rise to an extremely accessible and malleable program state history, allowing for the easy addition of features like infinite undo/redo, rewind/replay, time-travel debugging, and so on. Immutability can be achieved in either paradigm, but a proliferation of shared stateful objects complicates the implementation in OOP.

5. When is classical inheritance an appropriate choice?
Rarely, almost never, or never.
A single level is sometimes OK, from a framework base-class such as React.Component.
“Favor object composition over class inheritance.”




6. When is prototypal inheritance an appropriate choice?
There is more than one type of prototypal inheritance:

Delegation (i.e., the prototype chain).
Concatenative (i.e. mixins, `Object.assign()`).

Comments

Popular posts from this blog

உடல் அறிகுறிகள், வலிகள் மற்றும் அவற்றின் சிகிச்சைகள்: வீட்டு சிகிச்சைகள் மற்றும் அக்குபிரஷர் புள்ளிகள்

MySQL table and want to build a XML file with it in order to make a RSS feed.

REST / AJAX calls from within a Jaggery script