Top JavaScript interview questions.
What's good to hear in answer and what raises red flag:
1. Can you name two programming paradigms important for JavaScript app developers?
JavaScript is a multi-paradigm language, supporting imperative/procedural programming along with OOP (Object-Oriented Programming) and functional programming. JavaScript supports OOP with prototypal inheritance.
Good to hear:
Prototypal inheritance (also: prototypes, OLOO).
Functional programming (also: closures, first class functions, lambdas).
Red flags:
No clue what a paradigm is, no mention of prototypal oo or functional programming.
#javascript #js
What's good to hear in answer and what raises red flag:
1. Can you name two programming paradigms important for JavaScript app developers?
JavaScript is a multi-paradigm language, supporting imperative/procedural programming along with OOP (Object-Oriented Programming) and functional programming. JavaScript supports OOP with prototypal inheritance.
Good to hear:
Prototypal inheritance (also: prototypes, OLOO).
Functional programming (also: closures, first class functions, lambdas).
Red flags:
No clue what a paradigm is, no mention of prototypal oo or functional programming.
#javascript #js
2. What is functional programming?
Functional programming produces programs by composing mathematical functions and avoids shared state & mutable data. Lisp (specified in 1958) was among the first languages to support functional programming, and was heavily inspired by lambda calculus. Lisp and many Lisp family languages are still in common use today.
Functional programming is an essential concept in JavaScript (one of the two pillars of JavaScript). Several common functional utilities were added to JavaScript in ES5.
Good to hear:
πΉ 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.
Red flags:
π» No mention of pure functions / avoiding side-effects.
π» Unable to provide examples of functional programming languages.
π» Unable to identify the features of JavaScript that enable FP.
#javascript #js
Functional programming produces programs by composing mathematical functions and avoids shared state & mutable data. Lisp (specified in 1958) was among the first languages to support functional programming, and was heavily inspired by lambda calculus. Lisp and many Lisp family languages are still in common use today.
Functional programming is an essential concept in JavaScript (one of the two pillars of JavaScript). Several common functional utilities were added to JavaScript in ES5.
Good to hear:
πΉ 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.
Red flags:
π» No mention of pure functions / avoiding side-effects.
π» Unable to provide examples of functional programming languages.
π» Unable to identify the features of JavaScript that enable FP.
#javascript #js
3. What is the difference between classical inheritance and prototypal inheritance?
Class Inheritance: instances inherit from classes (like a blueprint β a description of the class), and create sub-class relationships: hierarchical class taxonomies. Instances are typically instantiated via constructor functions with the
Prototypal Inheritance: instances inherit directly from other objects. Instances are typically instantiated via factory functions or
In JavaScript, prototypal inheritance is simpler &
more flexible than class inheritance.
Good to hear:
πΉ Classes: create tight coupling or hierarchies/taxonomies.
πΉ Prototypes: mentions of concatenative inheritance, prototype delegation, functional inheritance, object composition.
Red Flags:
π» No preference for prototypal inheritance & composition over class inheritance.
#javascript #js
Class Inheritance: instances inherit from classes (like a blueprint β a description of the class), and create sub-class relationships: hierarchical class taxonomies. Instances are typically instantiated via constructor functions with the
new
keyword. Class inheritance may or may not use the class
keyword from ES6.Prototypal Inheritance: instances inherit directly from other objects. Instances are typically instantiated via factory functions or
Object.create()
. Instances may be composed from many different objects, allowing for easy selective inheritance.In JavaScript, prototypal inheritance is simpler &
more flexible than class inheritance.
Good to hear:
πΉ Classes: create tight coupling or hierarchies/taxonomies.
πΉ Prototypes: mentions of concatenative inheritance, prototype delegation, functional inheritance, object composition.
Red Flags:
π» No preference for prototypal inheritance & composition over class inheritance.
#javascript #js
4. When is classical inheritance an appropriate choice?
The answer is never, or almost never. Certainly never more than one level. Multi-level class hierarchies are an anti-pattern. Iβve been issuing this challenge for years, and the only answers Iβve ever heard fall into one of several common misconceptions. More frequently, the challenge is met with silence.
βIf a feature is sometimes useful
and sometimes dangerous
and if there is a better option
then always use the better option.β
~ Douglas Crockford
Good to hear:
πΉ 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.
#javascript #js
The answer is never, or almost never. Certainly never more than one level. Multi-level class hierarchies are an anti-pattern. Iβve been issuing this challenge for years, and the only answers Iβve ever heard fall into one of several common misconceptions. More frequently, the challenge is met with silence.
βIf a feature is sometimes useful
and sometimes dangerous
and if there is a better option
then always use the better option.β
~ Douglas Crockford
Good to hear:
πΉ 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.
#javascript #js
5. 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,
- Functional (Not to be confused with functional programming. A function used to create a closure for private state/encapsulation).
Each type of prototypal inheritance has its own set of use-cases, but all of them are equally useful in their ability to enable composition, which creates has-a or uses-a or can-do relationships as opposed to the is-a relationship created with class inheritance.
Good to hear:
πΉ In situations where modules or functional programming donβt provide an obvious solution.
πΉ When you need to compose objects from multiple sources.
πΉ Any time you need inheritance.
Red flags:
π» No knowledge of when to use prototypes.
π» No awareness of mixins or
#javascript #js
There is more than one type of prototypal inheritance:
- Delegation (i.e., the prototype chain).
- Concatenative (i.e. mixins,
Object.assign()
).- Functional (Not to be confused with functional programming. A function used to create a closure for private state/encapsulation).
Each type of prototypal inheritance has its own set of use-cases, but all of them are equally useful in their ability to enable composition, which creates has-a or uses-a or can-do relationships as opposed to the is-a relationship created with class inheritance.
Good to hear:
πΉ In situations where modules or functional programming donβt provide an obvious solution.
πΉ When you need to compose objects from multiple sources.
πΉ Any time you need inheritance.
Red flags:
π» No knowledge of when to use prototypes.
π» No awareness of mixins or
Object.assign()
.
#javascript #js
ReactJS Interview questions
https://www.educba.com/reactjs-interview-questions/
#javascript #js #reactjs
ββββββββββββββ
Join @coding_interview_preparation for more interview questions.
*This channel belongs to @bigdataspecialist group
https://www.educba.com/reactjs-interview-questions/
#javascript #js #reactjs
ββββββββββββββ
Join @coding_interview_preparation for more interview questions.
*This channel belongs to @bigdataspecialist group
EDUCBA
Top 21 ReactJS Interview Questions and Answers in 2023
ReactJS Interview Questions: 1. What is ReactJS? 2. What is JSX? 3. What is Flux? 4. What are Props and State? 5. What are refs?
PatrickJS/ngExam
An AngularJS exam with questions from beginner to expert by @gdi2290 from @AngularClass
Creator: PatrickJS
Stars βοΈ: 365
Forked By : 61
GitHub Repo: https://github.com/PatrickJS/ngExam
#PatrickJs #Js #Angular
ββββββββββββββ
Join @coding_interview_preparation for more interview questions.
*This channel belongs to @bigdataspecialist group
An AngularJS exam with questions from beginner to expert by @gdi2290 from @AngularClass
Creator: PatrickJS
Stars βοΈ: 365
Forked By : 61
GitHub Repo: https://github.com/PatrickJS/ngExam
#PatrickJs #Js #Angular
ββββββββββββββ
Join @coding_interview_preparation for more interview questions.
*This channel belongs to @bigdataspecialist group
GitHub
GitHub - PatrickJS/ngExam: An AngularJS exam with questions from beginner to expert by @gdi2290 from @AngularClass
An AngularJS exam with questions from beginner to expert by @gdi2290 from @AngularClass - GitHub - PatrickJS/ngExam: An AngularJS exam with questions from beginner to expert by @gdi2290 from @Angul...
π1