-
-
Save doggy8088/07c6dde26a42b622e03e90d714b7a502 to your computer and use it in GitHub Desktop.
【JavaScript 開發實戰:核心概念篇】額外的觀念驗證
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
var a = { 'a1': 1, 'a2': 2 }; | |
var b = []; | |
b.push(a); | |
b.push(a); | |
b[0]['a1'] = 2; | |
/**********************************/ | |
/* 請問此時 b[1]['a1'] 的值為多少? */ | |
/**********************************/ |
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
var a = { 'a1': 1, 'a2': 2 }; | |
var b = []; | |
b.push(a); | |
b[0]['a1'] = 2; | |
/**********************************/ | |
/* 請問此時 a['a1'] 的值為多少? */ | |
/**********************************/ |
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
var a = {x:1}; | |
var b = a; | |
a = {x:2}; | |
/**********************************/ | |
/* 請問此時 b.x 的值為多少? */ | |
/**********************************/ |
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
var a = {x:1}; | |
var p = a.x; | |
p = 2; | |
/**********************************/ | |
/* 請問此時 a.x 的值為多少? */ | |
/**********************************/ |
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
var a = {x:1}; | |
var b = a; | |
a.x = a = {x:2}; | |
/**********************************/ | |
/* 請問此時 b.x 與 a.x 的值為多少? */ | |
/**********************************/ |
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
var a = 1; | |
function test(p) { | |
p = 2; | |
} | |
test(a); | |
/**********************************/ | |
/* 請問此時 a 的值為多少? */ | |
/**********************************/ |
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
var a = { 'a1': 1, 'a2': 2 }; | |
function test(p) { | |
p.a1 = 2; | |
} | |
test(a); | |
/**********************************/ | |
/* 請問此時 a.a1 的值為多少? */ | |
/**********************************/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment