For smart Primates & ROBOTS (oh and ALIENS ).

Saturday, May 25, 2024

Simple Class in JavaScript

Simple Class in JavaScript


Here is the below code that demonstrate that how to create class and how to use it.


<script>
class WORKER {
    #step1(){console.log("RUN step1");}
    #step2(){console.log("RUN step2");}
    #step3(){console.log("RUN step3");}
    #step4(){console.log("RUN step4");}
    #step5(){console.log("RUN step5");}
    init() {
        this.#renderHTMLFromURL();
    }
    #renderHTMLFromURL = () => {
        this.#step1();
    this.#step2();
    this.#step3();
    this.#step4();
    this.#step5();
    }
}
new WORKER().init();
</script>

Share:

Related Posts:

0 comments:

Post a Comment

Ads Inside Post

Powered by Blogger.

Archive