Javascript pass parameters by value (and by reference value) example

1 · Adrian Matei · Aug. 7, 2021, 6:49 a.m.
Still confused about how passing variables in Javascript functions works? So was I, until recently. It took me some effort to understand, and I’d like to share my understanding with an example. First try guessing the outcome of the following javascript snippet Input const number = 1983 const string = 'Adrian' let obj1 = { value: 'obj1' } let obj2 = { value: 'obj2' } let obj3 = obj2; let obj4 = ['a']; function change(numberParam, stringParam, obj1Param, obj2Param, obj4Param) { console....