In this article you will learn the basics Classes and Objects of JavaScript and create the examples of Classes and Objects in JavaScript .
About Object
JavaScript is a object oriented programming language so, its variables is
depending upon the objects. In object oriented programming language , user
create own object to use variables types. An object is a special kinds of data
and it contains the properties and methods. JavaScript has several built in
objects. Such as: Array, String, Date e.t.c. .
Syntax to create an object:-
object_Name.properties_Name
The example to create an object and display the some results:-
| <html> <body> <script language=javascript"> stuobj=new Object() stuobj.name="vinod" stuobj.roll=10 stuobj.sub="Computer" document.write("Student Name :- "+stuobj.name + " Roll no. :- " +stuobj.roll + " Subject :- " +stuobj.sub); </script> </body> </html> |
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Classes-Objects in JavaScript View All Comments
Post your Comment