柯聞折Javascript物件導向方法是物件的函數
物件導向設計OOP=Object-Oriented Programming
主詞subject受詞object東方的oriental2330 股數 100
2880 股數 1000
花旗銀行 股數 100
美國電話電報 股數 1000
id=identity,身分證id card, division區塊,段落
.方法get()是取得對應的值,功能同字典dict.get(s1.code)從dict字典取得索引為s1.code的值
劉任昌以上的程式碼
<H1>物件導向設計OOP=Object-Oriented Programming</H1>主詞subject受詞object東方的oriental<P id="cat"></P><P id="dog"></P><P>id=identity,身分證id card, division區塊,段落</P><script>//Javascript註解二斜線//Python註解#dict =new Map([["2303","聯電"],["2330","台積電"],["2880","華南金"]]);//宣告配對(字典)class Stock{ //宣告類別constructor(code, shares, price){//建構子constructorthis.code = code;this.shares = shares;this.price = price;}}s1 = new Stock("2330", 100, 1000); //建構子Stock建構s1s2 = new Stock("2880", 1000, 30); //建構子Stock建構s2st = s1.code+' 股數 '+s1.shares.toString()+'<BR>'+s2.code.toString()+' 股數 '+s2.shares;document.getElementById('cat').innerHTML = st;st = dict.get(s1.code)+' 股數 '+s1.shares.toString()+'<BR>'+dict.get(s2.code)+' 股數 '+s2.shares;document.getElementById('dog').innerHTML = st;</script>.方法get()是取得對應的值,功能同字典<P>dict.get(s1.code)從dict字典取得索引為s1.code的值<P>
加上美國股票的程式碼
<h1>物件導向設計OOP=Object-Oriented Programming</h1> 主詞subject受詞object東方的oriental <p id="cat"></p> <p id="dog"></p> <p>id=identity,身分證id card, division區塊,段落</p> <script>//Javascript註解二斜線//Python註解# dict =new Map([["2303","聯電"],["2330","台積電"],["2880","華南金"],['AAPL','蘋果公司'],['C','花旗銀行'],['T','美國電話電報']]);//宣告配對(字典) class Stock{ //宣告類別 constructor(code, shares, price){//建構子constructor this.code = code; this.shares = shares; this.price = price;} } s1 = new Stock("2330", 100, 1000); //建構子Stock建構s1 s2 = new Stock("2880", 1000, 30); //建構子Stock建構s2 s3 = new Stock("C", 100, 1000); //建構子Stock建構s1 s4 = new Stock("T", 1000, 30); //建構子Stock建構s2 st = s1.code+' 股數 '+s1.shares.toString()+'<BR>'+s2.code.toString()+' 股數 '+s2.shares; document.getElementById('cat').innerHTML = st; st = dict.get(s3.code)+' 股數 '+s3.shares.toString()+'<BR>'+dict.get(s4.code)+' 股數 '+s4.shares; document.getElementById('dog').innerHTML = st; </script>
https://allyking097.blogspot.com/2025/04/javascriptpython.html
回覆刪除https://lu-chieh-chi.blogspot.com/2025/04/javascriptpython.html
回覆刪除https://egdvcn-gh.blogspot.com/2025/04/javascriptpython.html
回覆刪除https://yuxi1202.blogspot.com/2025/04/javascriptpython.html
回覆刪除https://yangsinmei.blogspot.com/2025/04/javascript.html
回覆刪除https://h5ying.blogspot.com/2025/04/javascript.html
回覆刪除https://hsulining9999.blogspot.com/2025/04/javascriptpython_15.html
回覆刪除https://laichia-jung.blogspot.com/2025/04/javascript.html
回覆刪除https://yehjungwen.blogspot.com/2025/04/javascript.html
回覆刪除https://huangchenyang.blogspot.com/2025/04/javascript.html
回覆刪除https://chang-yam-ci.blogspot.com/2025/04/javascript.html
回覆刪除https://syx0304syx.blogspot.com/2025/04/javascript.html
回覆刪除https://djhdvdhd.blogspot.com/2025/04/blog-post_15.html
回覆刪除https://yezonghan.blogspot.com/2025/04/javascript.html
回覆刪除https://jiang233.blogspot.com/2025/04/javascript.html
回覆刪除https://spy0928.blogspot.com/2025/04/javascript.html
回覆刪除https://anson0501.blogspot.com/2025/04/011.html
回覆刪除https://htmlsyuan.blogspot.com/2025/04/javascriptpython.html
回覆刪除https://yangbokai.blogspot.com/2025/04/javascript.html
回覆刪除https://wwersseraaer.blogspot.com/2025/04/javascript.htm
回覆刪除https://d11317133.blogspot.com/2025/04/oopobject-oriented-programming.html
回覆刪除https://yuanxuzhi.blogspot.com/2025/04/javascript_15.html
回覆刪除https://xie-ni.blogspot.com/2025/04/javascript.html
回覆刪除https://chenwewen.blogspot.com/2025/04/javascriptpython_15.html
回覆刪除https://ting22222.blogspot.com/2025/04/javascriptpython.html
回覆刪除https://ericfggf554466.blogspot.com/2025/04/javascript.html
回覆刪除https://huangyunchieh.blogspot.com/2025/04/javascript.html
回覆刪除https://jiang-jia-ehen.blogspot.com/2025/04/javascript.html
回覆刪除https://wei1029.blogspot.com/2025/04/javascriptpython.html
回覆刪除https://xin00.blogspot.com/2025/04/javascript.html
回覆刪除https://shanny11336108.blogspot.com/2025/04/oopobject-oriented-programming.html
回覆刪除https://guovupvmp.blogspot.com/2025/04/javascript.html
回覆刪除https://zhuo-you-wen.blogspot.com/2025/04/javascript.html
回覆刪除https://htmlcss-hsiao.blogspot.com/2025/04/javascript.html
回覆刪除作者已經移除這則留言。
回覆刪除https://huangjunzhu.blogspot.com/2025/04/oopobject-oriented-programming.html
回覆刪除https://xiyuying.blogspot.com/2025/04/javascript.html
回覆刪除https://leelittle25147.blogspot.com/2025/04/javascript.html
回覆刪除https://ting950214.blogspot.com/2025/04/javascript.html
回覆刪除https://zzy-hn.blogspot.com/2025/04/javascriptpython_15.html
回覆刪除https://chrishong9595.blogspot.com/2025/04/javascript.html
回覆刪除https://yichen0617.blogspot.com/2025/04/javascript.html
回覆刪除https://sklnfijseifjsk.blogspot.com/2025/04/javascript.html
回覆刪除https://d11051137.blogspot.com/2025/04/javascript.html
回覆刪除https://bfbfbfbfbfsgrjryjyrjj.blogspot.com/2025/04/0415.html
回覆刪除https://zhou-wei-ling.blogspot.com/2025/04/oopobject-oriented-programming.html
回覆刪除https://zhang-1108.blogspot.com/2025/04/buttonbackgroundpinkfont.html
回覆刪除https://sincewayne.blogspot.com/2025/04/htmlbuttonbuttononclick.html
回覆刪除https://sccabout.blogspot.com/2025/04/htmlbutton-onclick.html
回覆刪除https://lu-cheng-yin-2024.blogspot.com/2025/04/oopobject-oriented-programming.html
回覆刪除https://zhuo-1005.blogspot.com/2025/04/blog-post.html
回覆刪除https://vovo8564513.blogspot.com/2025/04/htmlbuttononclick.html
回覆刪除https://huutingyu.blogspot.com/2025/04/htmlbuttononclick.html
回覆刪除https://pei940922.blogspot.com/2025/04/htmlbuttonunclick.html
回覆刪除https://acdhdwstzws.blogspot.com/2025/04/htmlbuttononclick.html
回覆刪除https://www.blogger.com/blog/post/edit/2791737318440334753/2189557235077082691
回覆刪除https://lupeiying.blogspot.com/2025/04/javascriptbuttononclickcall.html
回覆刪除https://jiang233.blogspot.com/2025/04/javascriptbuttononclickcall.html
回覆刪除