For smart Primates & ROBOTS (oh and ALIENS ).

Blogroll

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:

0 comments:

Post a Comment

How to make center align child div

 How to make center align child div?   Suppose you have 2 Div tag. And want the make inner tag center <div id="d1">      ...

Ads Inside Post

Powered by Blogger.

Arsip