Skip to main content

Two programming paradigms important for JavaScript Developers

Javascript is a multi-paradigm language. It supports OOP as well as function programming. Prototypal inheritance in JavaScript OOP is a must to know. In functional programming, important concepts to understand are: closures, first class function and lambdas.

Comments

Popular posts from this blog

Learn JavaScript - Comment

If you want to learn programming languages, first you should learn how to write comment in the chosen language. Comments are ignored by the language compiler or interpreter but they are not ignored by yourself or other human beings. So comments are really important and make you productive as well as other person who want to update or correct your code. Writing comments make you a better programmer. There are two ways of writing comment in JavaScript. 1. Single line comment starting with // and finishing at the end of the line.  2. Multi line comment spanning more than one line starting with /* and finishing with */

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

OOP Pros: It’s easy to understand the basic concept of objects and easy to interpret the meaning of method calls. OOP tends to use an imperative style rather than a declarative style, which reads like a straight-forward set of instructions for the computer to follow. OOP Cons: OOP Typically depends on shared state. Objects and behaviors are typically tacked together on the same entity, which may be accessed at random by any number of functions with non-deterministic order, which may lead to undesirable behavior such as race conditions. FP Pros: Using the functional paradigm, programmers avoid any shared state or side-effects, which eliminates bugs caused by multiple functions competing for the same resources. With features such as the availability of point-free style (aka tacit programming), functions tend to be radically simplified and easily recomposed for more generally reusable code compared to OOP. FP also tends to favor declarative and denotational styles...