Last active
October 2, 2018 04:52
-
-
Save nluo/6957968062958959f435621d0145f8dc to your computer and use it in GitHub Desktop.
Pass by value
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
function changeNumber (thing) { | |
thing = thing + 1 | |
} | |
const myNumber = 123 | |
changeNumber(myNumber) | |
console.log('my number is ', myNumber) | |
function changeString (str) { | |
str = `hello ${str}` | |
} | |
const str = 'nick' | |
changeString(str) | |
console.log('str is ', str) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment