Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering JavaScript Design Patterns

You're reading from   Mastering JavaScript Design Patterns Discover how to use JavaScript design patterns to create powerful applications with reliable and maintainable code

Arrow left icon
Product type Paperback
Published in Nov 2014
Publisher
ISBN-13 9781783987986
Length 290 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Simon Timms Simon Timms
Author Profile Icon Simon Timms
Simon Timms
Arrow right icon
View More author details
Toc

Chapter 6. Functional Programming

Functional programming is a different approach to development than the heavily object-oriented approach that we have focused on so far. Object-oriented programming is a fantastic tool to solve a great number of problems but it has some issues. Parallel programming within an object-oriented context is difficult, as the state can be changed by various different threads with unknown side effects. Functional programming does not permit state or mutable variables. Functions act as primary building blocks in functional programming. Places where you might have used a variable in the past will now use a function.

Even in a single-threaded program, functions can have side effects that change the global state. This means that calling an unknown function can alter the whole flow of the program. This makes debugging a program quite difficult.

JavaScript is not a functional programming language but we can still apply some functional principles to our code. We...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime