DEV Community

Discussion on: Functional Programming Part 1 – Intro to functional programming

Collapse
 
mjsarfatti profile image
Manuele J Sarfatti

Hi Muhammad and thank you for the article, however I have to highlight a possible mistake and source of confusion:

const does not guarantee immutability in JavaScript, but rather non-reassignability.

For example:

const a = "Hello world!"
a = 1975 // ❌ NOT allowed

But:

const Person = {
  name: "Susan",
  lastName: "Doe",
}
Person.name = "Kate" // ✔️ allowed
Collapse
 
nerdjfpb profile image
Muhammad Ali (Nerdjfpb)

Yes I understand this part! I forgot about the object part!