Get Schooled at New Horizons

Info and insights from New Horizons Computer Learning Centers. 22 locations to serve you.
Start exploring

Embrace arrow functions to write clean, condensed code(JavaScript)

Modern web developers are constantly working on ways to simplify the development process and streamline code. Not only does this make code easier to write, but efficient code doesn’t need a long explanation when working on team projects or passing the baton to a fresh developer. The arrow function is an improved way to manage the “this” keyword and to boil down long trails of code. Essentially, the arrow function eliminates the need to spell out one-line functions such as “function” or “return”. The arrow function is written like this: => =.

For example, rewrite: var add = function (x,y) {  return x + y;} as: var add = (x,y) => {  return x + y;} to put the arrow function to work.


Leave a Reply