Learn to identify them, make habits to avoid them

Image for post
Image for post

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. …

Image for post
Image for post

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 argument, full body:
name => { return name.split(' ')…

Image for post
Image for post

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 with their mobile application. …


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