Knowledge Walls
Ammu
Hyderabad, Andhra Pradesh, India
Passcode:
Classes in Examples of Javascript 1
1482 Views
Example
<!DOCTYPE html>
    <html lang="en-US">
    <head>
        <meta charset="UTF-8">
        <title>changing css</title>
        <script>
            class Student{
                
                constructor(stud,number)
                {
                    this.Student=stud;
                    this.Number=number;
                }
                
                show()
                {
                    document.write("Name:"+this.Student+"<br>");
                    document.write("No:"+this.Number+"<br>");                                 
              
                }
                
                setName(stud)
                {
                   this.Student=stud;
                }
                
                getName()
                {
                    return this.Student;
                }
                
            }
            
            var stud1=new Student("vidhyaa",20);
            stud1.show();
            stud1.setName("vidhyaa Parthasarathy");
            document.write(stud1.getName()+"<br>");
            stud1.show();
            var stud2=new Student("partha",25);
            stud2.show();
        </script>
    </head>
    <body>
        
    </body>
</html>
Next Topics
Next lessons of current book.
Previous Topics
Previous lessons of current book.
Examples of Javascript 1
Examples of Javascript 1
Examples of Javascript 1
Examples of Javascript 1
Best Lessons of "Javascript 1"
Top lessons which are viewed more times.
Examples of Javascript 1
Examples of Javascript 1
Examples of Javascript 1
Examples of Javascript 1
Examples of Javascript 1
Examples of Javascript 1
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details