Skip to content
Akin C edited this page Aug 30, 2019 · 18 revisions

Welcome to the Javascript-mutable-data-and-prototypes- wiki!

This repository is part of a larger project!

◀️ PREVIOUS PROJECT| NEXT PROJECT ▶️


Javascripts prototype has its benefits, but the use of mutable data within prototype should be done with caution.

There exists also immutable(unchangeable) data.

The difference very simply put seems to lie in memory allocation.

Here follows an purely made up example of an immutable variable:

// Variable x has the memory ID 42 
var x = 5; 

// Variable x changed its memory ID to 666
x = 4;

Interpreting the listing above a mutable vaiable would have a fixed memory ID while an immutable has not.

"...Mutable is a type of variable that can be changed. In JavaScript, only objects and arrays are mutable, not primitive values..."1

It seems to check the memory allocation when used javascript variables is not as easy as in other programming languages.

Content

Short Concept Idea

In this section follows now a short explanation of the concept which was used in the code implementation.

STILL IN WORK!!!

Clone this wiki locally