OOP Introduction tutorial in Advance JavaScript

 <!DOCTYPE html>

<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>OOPS Introduction Advance JavaScript</title>
    <link rel="stylesheet" href="">
</head>

<body>
    <script>
        class student {
            message() {
                document.write("Hello Everyone<br>");
            }
            sorry() {
                document.write("Sorry Everyone<br>");
            }
            constructor(name, age) {
                this.studentname = name;
                this.studentage = age;
                document.write("Constructor Function<br>");
            }
            hello() {
                console.log(`Hello ${this.studentname}, Your age is : ${this.studentage}`);
            }
            static staticMethod() {
                console.log("Static Method");
            }
        }
        let a = new student("World, How are you ?", 25);
        let b = new student("Brother, next time we will go outside", 45);
        a.message();
        a.sorry();
        a.hello();
        b.hello();
        student.staticMethod();
    </script>
</body>

</html>








Comments

Popular posts from this blog

Symbols tutorial in Advance JavaScript

Async and Await Method tutorial in Advance JavaScript

String Methods in JavaScript