Update: This article is now part of my book “The Professional Programmer”.

Read the updated version of this content, and more programming advice at jscomplete.com/pro-programmer.

Let me make one thing clear first. If you are a beginner programmer, this article is not meant to make you feel bad about the mistakes that you might be making but rather to make you aware of them, teach you to spot signs of them, and remind you to avoid them.

I have made these mistakes in the past and learned from each and every one of them. I am happy to have formed…

So you want to create a function in JavaScript?

You. Have. Options:

1 — Declaration Function

function sum(a, b) { return a + b; } 

2 — Expression Function

// Can be named:
(function sum(a, b) { return a + b; });
// Or anonymous (AVOID):
(function(a, b) { return a + b; });
// Or assigned to a variable
const sum = function sum(a, b) { return a + b; })

3 — Arrow Function

// Single argument, one line return:
name => name.split(' ')
// Multi arguments, one line return:
(a, b) => a + b
// Single…


I am writing the GraphQL In Action book for Manning and 8 chapters (out of 11) has been published to MEAP. Below is the entire first chapter of the book. Feedback is welcome and very much appreciated.

This chapter covers

  • What GraphQL is and the design concepts behind it
  • How GraphQL is different from its alternatives, like REST APIs
  • The language and service parts of a GraphQL system
  • The advantages and disadvantages of GraphQL

Necessity is the mother of invention. The product that inspired the creation of GraphQL was invented at Facebook because they needed to solve many technical issues…

The difference between callbacks and promises in JavaScript is subtle but significant! Why exactly are we ditching callbacks in favor of promises?

How would you answer these questions in an interview??

The superiority of promises over callbacks is all about trust and control. Let me explain.

We generally need to use callbacks or promises when there is a slow process (that’s usually IO-related) that we need to perform without blocking the main program process. I once compared giving an asynchronous worker a callback function to giving a barista in a coffee shop your name to have it called when your…

One of the projects I am involved in is hiring a senior JavaScript developer. To help with the opportunity, I tweeted this:

The response. Was. Overwhelming

I certainly did not expect this much interest in a work opportunity about which I did not share many details!

A few hours after a single tweet, my inbox already had a couple of good candidates. After sifting through the initial set of replies received in the first 24 hours, I see at least 10 candidates who would be ideal for this job.

Why then is everyone saying that hiring coders is so…

The GraphQL schema language is great! It is certainly the best way to communicate anything about a GraphQL service. No wonder all documentations now use it!

The Schema Language

Imagine that you’re building a blog app (with GraphQL) that has “Articles” and “Comments” . You can start thinking about its API schema by basing it on what you plan for its UI. For example, the main page will probably have a list of articles and an item on that list might display a title, subtitle, author’s name, publishing date, length (in reading minutes), and a featured image. …

React developers love the modern features in JavaScript and use them extensively in their projects. In this guide, I’ll go over the most popular features that are usually used with React. Most of these features are modern to JavaScript but I’ll also talk about some older ones that are related and important for React.

This will NOT be a complete list of everything offered by the JavaScript language but rather the subset that I think will help you write better code for React.

Block scopes and the var/let/const keywords

A block scope is created with a pair of curly brackets. This happens every time you create…

Before I answer, if you‘re reading this article to pick a framework “to learn”, don’t. Read this article instead.

If you want to pick a framework to use (in an actual project), you may proceed :)

“Better” is really subjective. Better for what?

  • Scalability? Code written for all 3 frameworks can be scaled as much as needed if we’re talking about performance. Some frameworks will have smarter optimization every now and then, but eventually all frameworks will follow any good smart optimization that gets battle-tested out there.
  • Syntax and readability? You (person or team) be the judge! Try them all…

A few weeks ago, I tweeted this interview question:

*** Answer the question in your head now before you proceed ***

About half the replies to the Tweet were wrong. The answer is NOT V8 (or other VMs)!! While famously known as “JavaScript Timers”, functions like setTimeout and setInterval are not part of the ECMAScript specs or any JavaScript engine implementations. Timer functions are implemented by browsers and their implementations will be different among different browsers. Timers are also implemented natively by the Node.js runtime itself.

In browsers, the main timer functions are part of the Window interface, which…

Let me first define what I think a coding framework is because the word is debatable. I think a framework is a library that defines structures about every aspect or layer that can make the task of creating applications easier. By layers, I mean things like databases, models, controllers, views, presenters, networks, etc..

Frameworks try to solve most of the big and known problems that are usually encountered by their applications. They have built-in design decisions that you do not need to worry about. They also have carefully-crafted guidelines.

Good frameworks also have smart defaults and follow the convention over…

Samer Buna

Author for Pluralsight, O'Reilly, Manning, and LinkedIn Learning. Curator of jsComplete.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store