JavaScript class 使用

來源:互聯網
上載者:User

標籤:zh-cn   infoq   dem   簡單的   文法糖   定義類   googl   style   developer   

/********************************************************************* *                     JavaScript class 使用 * 說明: *     Javascript類的寫法有多種,不過不打算用那些傳統方法,使用文法糖class * 來直接解決,能簡單的那就不用複雜的。 * *                                   2017-8-25 深圳 龍華樟坑村 曾劍鋒 ********************************************************************/一、參考文檔:    1. 繼承與原型鏈        https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Inheritance_and_the_prototype_chain    2. 文法糖        https://zh.wikipedia.org/wiki/%E8%AF%AD%E6%B3%95%E7%B3%96    3. Javascript定義類(class)的三種方法        http://www.ruanyifeng.com/blog/2012/07/three_ways_to_define_a_javascript_class.html    4. 深入淺出ES6(十三):類 Class        http://www.infoq.com/cn/articles/es6-in-depth-classes    5. Classes (ES6) Sample        https://googlechrome.github.io/samples/classes-es6/二、參考代碼:    1. 請參考《Classes (ES6) Sample》中的代碼。    2. 最簡單的demo:        class Zengjf_utils {            constructor() {                console.info("Zengjf");            }            ...        }        class ZengjfOS extends Zengjf_utils{            constructor() {                super()                console.info("ZengjfOS");            }            ...        }

 

JavaScript class 使用

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.