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
Advanced JavaScript

You're reading from   Advanced JavaScript Speed up web development with the powerful features and benefits of JavaScript

Arrow left icon
Product type Paperback
Published in Jan 2019
Publisher
ISBN-13 9781789800104
Length 330 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Zachary Shute Zachary Shute
Author Profile Icon Zachary Shute
Zachary Shute
Arrow right icon
View More author details
Toc

Immutability


Immutability is a very simple concept but very important to Functional Programming. The textbook definition of immutability is simply "something that is not changeable." In programming, we use the word to mean objects and variables whose state cannot be changed after they have been created.

In software development, values can be passed into functions by reference. When a variable is passed by reference, it means that a reference to the memory location (a pointer) is passed instead of the serialized value of the object contained at that location in memory. Since all of the pointers for a variable passed by reference point to the same block of memory, any update to the value of the variable passed by reference will be seen by any pointer pointing to that block of memory. Any variable passed by reference instead of by value can be considered a shared state, since it can be modified by multiple separate scopes. It is important to write functions that prevent the mutation of data...

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 $19.99/month. Cancel anytime