Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
imagine building an app using javascript(react-native) that get list of skills which will be displayed to the user to select and the same list displayed as interest for the user to do the same if you try to treat them seperately but from the same source you get a shit result e.g
const list = responseFromApi;//array of object
let skills = list;;
let interest = list;
skills.checked = true;
interest is changed and the list constant variable is changed the values change were ever the list variable is assign to a variable and the variable is tempered.
the above code was the fustration i got with javascript when i didnt know of the mutation guy.
Mutation is a nightmare never knew javascript object are passed by reference which make them mutable this sucks....
another crazy behavior below though the same;
const person = {name:'Dan',age:43} //object
let person0 = person;
let person1 = person;
person1.name = 'David'
the value of both person0 and person get change.
this is madness .
rant