劉任昌Javascript物件導向Python物件導向
python語言的OOP=物件導向程式設計: 物件.屬性(attribute, property)
物件.方法(method)
方法就是物件的函數
物件導向程式設計
Javascript指令new Constructor產生新的instance案例
s1.shares.toString()=案例sa的屬性shares內建方法toString()轉成字串,原來的數字被轉成字串string才可以和其他字串相加
Javascript程式碼
<DVI ID='cat'></DVI> <SCRIPT> 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", 1000, 30); //建構子Stock建構s2 st = s1.code+' 股數 '+s1.shares.toString()+'<BR>'+s2.code.toString()+' 股數 '+s2.shares; document.getElementById('cat').innerHTML = st;</SCRIPT>
Javascript程式碼加入配對(字典)指令
dict =new Map([["2303","聯電"],["2330","台積電"],["2880","華南金"]]);//宣告配對(字典)
https://chenyenhsun.blogspot.com/2025/04/javascriptpython_14.html
回覆刪除https://gbsddik.blogspot.com/2025/04/javascriptpython_14.html
回覆刪除https://ting100000.blogspot.com/2025/04/dict-new-map230323302880-class-stock.html
回覆刪除https://lin-yujing.blogspot.com/2025/04/javascriptpython.html
回覆刪除https://danny0976790127.blogspot.com/2025/04/javascript-python.html
回覆刪除https://tzuchenchu.blogspot.com/2025/04/javascriptpython_14.html
回覆刪除https://ypayupinan.blogspot.com/2025/04/javascriptpython.html
回覆刪除https://jiachiangkuo.blogspot.com/2025/04/415.html
回覆刪除https://vovo8564513.blogspot.com/2025/04/javascriptpython_14.html
回覆刪除https://pei940922.blogspot.com/2025/04/javascriptpython-4-14-2025.html
回覆刪除https://koala111222.blogspot.com/2025/04/blog-post.html
回覆刪除https://acdhdwstzws.blogspot.com/2025/04/javascriptpython_14.html
回覆刪除https://slu804387.blogspot.com/2025/04/javascriptpython_14.html
回覆刪除https://huutingyu.blogspot.com/2025/04/javascriptpython.html
回覆刪除https://zhuo-1005.blogspot.com/2025/04/javascriptmap.html
回覆刪除作者已經移除這則留言。
回覆刪除作者已經移除這則留言。
回覆刪除https://yuweiiiiiiiiiiii.blogspot.com/2025/04/javascriptpython_14.html
回覆刪除https://pagestjing.blogspot.com/2025/04/javascriptpython.html
回覆刪除https://yangyoyo0125.blogspot.com/2025/04/javascriptpython.html
回覆刪除https://mumeng-ru.blogspot.com/2025/04/blog-post.html
回覆刪除https://zyixnn.blogspot.com/2025/04/javascriptpython.html
回覆刪除https://takming123.blogspot.com/2025/04/javascriptbrowser.html
回覆刪除https://gghfrefgd.blogspot.com/2025/04/javascriptpython.html
回覆刪除https://xuan-ang.blogspot.com/2025/04/javascriptpython_14.html
回覆刪除https://kiannc1201.blogspot.com/2025/04/javascriptpython_14.html
回覆刪除https://sccabout.blogspot.com/2025/04/javascript.html
回覆刪除https://chinenkohana.blogspot.com/2025/04/kohana-javascriptpython.html
回覆刪除https://d11117242.blogspot.com/2025/04/javascriptpython.html
回覆刪除https://winnielee0311.blogspot.com/2025/04/javascriptpython_14.html
回覆刪除https://sincewayne.blogspot.com/2025/04/javascriptpython_14.html
回覆刪除https://takuto20050803.blogspot.com/2025/04/javascriptpython.html
回覆刪除https://yangyami.blogspot.com/2025/04/javascriptpython_14.html
回覆刪除作者已經移除這則留言。
回覆刪除https://jamie941128.blogspot.com/2025/04/0415.html
回覆刪除https://xu-bing-wei-0804.blogspot.com/2025/04/class-stock-constructorcode-shares.html
回覆刪除作者已經移除這則留言。
回覆刪除https://d11117315111.blogspot.com/2025/04/javascriptpython.html
回覆刪除