Created
September 12, 2021 06:19
-
-
Save yeonwooz/15d1f59e0d75cb9ec945d9194409b816 to your computer and use it in GitHub Desktop.
mutableCloining
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const addition = (param) => { | |
console.log(param) // [] | |
const copiedParam = param | |
console.log('param', param, 'copiedParam', copiedParam) // param [] copiedParam [] | |
param.push(11111) | |
copiedParam.push(22222) | |
console.log('param', param, 'copiedParam', copiedParam) // param [11111, 22222] copiedParam [11111, 22222] | |
return {param: param, copiedParam:copiedParam} // {param: [11111, 22222], copiedParam: [11111, 22222]} | |
} | |
const a = [] | |
addition(a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment