卓秉璿Javascript物件導向Map配對
<DVI ID='cat'></DVI>
<SCRIPT>
dict =new Map([["2303","聯電"],["2330","台積電"],["2880","華南金"]]);//宣告配對(字典)
class Stock{ //宣告類別
constructor(code, shares, price){
this.code = code;
this.shares = shares;
this.price = price;}
}
s1 = new Stock("2330", 100, 1000); //建構子Stock建構s1
s2 = new Stock("2880", 10000, 30); //建構子Stock建構s2
st = s1.code+' 股數 '+s1.shares.toString()+'<BR>'+s2.code.toString()+' 股數 '+s2.shares;
document.getElementById('cat').innerHTML = st;
</SCRIPT>
期中考完善執行.https://d11117315111.blogspot.com/2025/04/htmlbuttononclick.html
回覆刪除補做W3SCHOOLS.https://d11117315111.blogspot.com/2025/04/javascriptpython.html
期中考.https://zhuo-1005.blogspot.com/2025/04/blog-post.html
卓秉璿415.https://zhuo-1005.blogspot.com/2025/04/javascriptmap.html