2. Java is OOPS based programming language while Java Script is an Object oriented programming scripting language.
What is Object Oriented Programming?
Object oriented programming is a programming language model designed to simplify complicated programming concepts. it’s a programming model organized on the concept of “objects”, which are data structures that contain data, in the form of fields, often known as attributes and code in the form of procedures, often known as methods.
Objects and Properties:-
Web Page document is an object. Any image, button, table, form or link in web page is an object. Each object has certain properties i.e. information about the object. For example, consider the background color of document is written as document.bgcolor. We can change the color of web page to any other color by writing the line: document.bgcolor=”blue”
Most objects have certain collection of things that they can do. Different objects can do different things, just as door can open and close, while a light can turn on and off. A new document is opened with the method document.open() You can write “Hello World” into a document by typing document.write(“Hello World”). open() and write() are both methods of the object: document.
Events are how it trigger our functions to run. The simple example is a button, whose definition includes the words onClick=”run_function()”. The onClick event, as its name implies, will run the function when the user clicks on the button. Other events include OnMouseOver, OnMouseOut, OnFocus, OnBlur, OnLoad, and OnUnload.