Skip to Content
Mastering JavaScript Functional Programming - Second Edition
book

Mastering JavaScript Functional Programming - Second Edition

by Federico Kereki
January 2020
Intermediate to advanced
470 pages
11h 13m
English
Packt Publishing
Content preview from Mastering JavaScript Functional Programming - Second Edition

Mutator functions

A common source of unexpected problems comes from the fact that several JavaScript methods are actually mutators that modify the underlying object. In this case, by merely using them, you will be causing a side effect, which you may not even recognize. Arrays are the most basic sources of problems and the list of troublesome methods isn't short:

  • copyWithin() lets you copy elements within the array.
  • fill() fills an array with a given value.
  • push() and pop() let you add or delete elements at the end of an array.
  • shift() and unshift() work in the same way as push() and pop(), but at the beginning of the array.
  • splice() lets you add or delete elements anywhere within the array.
  • reverse() and sort() modify the array in place, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering JavaScript Functional Programming

Mastering JavaScript Functional Programming

Federico Kereki

Publisher Resources

ISBN: 9781839213069Supplemental Content