JavaScript: an Overview

JavaScript (JS) is easy to use , dynamic computer programming language, commonly used as part of web browsers. it’s implementations allows client side scripts to interact with user, it can control the browser, communicate asynchronously, and alter the document content that is displayed. JavaScript is also used in game development, server side network programming with run-time environments such as Node.js and the creation of desktop and mobile applications.

What’s the difference between JavaScript and Java?
Both Language Java and JavaScript have nothing in common except the name. Although Java is OOPS based programming language, Java is coded in a way to C++, with class files, compiled prior to execution. Java is powerful enough to write major applications and insert them in a web page as a special object called an “applet”.

The JavaScript programming language, developed by Netscape, Inc., is not part of the Java platform. JavaScript is much simpler if compare with Java. In simpler form, JavaScript resides inside HTML documents and can provide interactivity to web pages that are not achievable with simple HTML. With JavaScript, if I want to check form for errors, just write if-then statement in the page.

Key differences between Java and JavaScript:-
1. Java is class based; JavaScript is prototype-based.
2. Java is OOPS based programming language while Java Script is an Object oriented programming scripting language.
3. Java applications run in a virtual machine or browser while JavaScript code runs on a browser only.
4. Java code compiles before run while JavaScript code are simple in text.

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 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.



Leave a Comment