Created
April 2, 2017 12:13
-
-
Save MikeDigitize/c588d31f2eacc9de25e2cd296b4aaabb to your computer and use it in GitHub Desktop.
This file contains hidden or 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 makeNull(a) { | |
a = null; | |
console.log('makeNull?', a); | |
} | |
var obj = { a: 1 }; | |
makeNull(obj); | |
console.log('null?', obj); | |
var str = 'mike'; | |
makeNull(str); | |
console.log('null?', str); | |
function makePropNull(a) { | |
a.a = null; | |
console.log('makePropNull?', a.a); | |
} | |
var obj2 = { a: 'mike' }; | |
makePropNull(obj2); | |
console.log('null?', obj2); | |
function swap(a, b) { | |
[b, a] = [a, b] | |
console.log('swap', a, b); | |
} | |
var a = 1, b = 2; | |
swap(a, b); | |
console.log('swapped?', a, b); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment