A overview of JavaScript
History of JavaScript
JavaScript was created at Netscape Communications by Brendan Eich in
1995. Netscape and Eich designed JavaScript as a scripting language for use with the company's flagship web browser, Netscape Navigator. Initially known as LiveScript, Netscape changed the name to JavaScript so they could position it as a companion for the Java language, a product of their partner, Sun Microsystems. Apart from some superficial syntactic similarities, though, JavaScript is in no way related to the Java programming language.
Four sorts of data
Nominal,
Ordinal,
Discrete,
Continuous.
Six primitives types:
- string ,
- number ,
- undefined ,
- null ,
- boolean ,
- symbol
More characteristics of javaScript
- Object-Centered Script Language
- Client edge Technology
- Validation of User’s Input
- Else and If Statement
- Interpreter Centered
- Ability to perform In Built Function
- Case Sensitive format
- Light Weight and delicate
- Statements Looping
- Handling Events
JavaScript Features
Now allow us to see the features of JavaScript in detail:
DOM Manipulation
The very reason why javascript was created is DOM manipulation. During the early time, the web was purely static. It was made dynamic by the introduction of Javascript. So what can javascript do with the DOM? a lot many things like changing all the HTML elements on the page and all their attributes. It can also change the CSS of every HTML element on the page. Javascript can add new elements in the page and remove the existing ones. It can also create new HTML events. DOM manipulation changed the web.The following is an example of using javascript for DOM manipulation.
In the body tag, there is one button tag used to create a button. Javascript is used to handle the button click event and when the button is clicked, “Hello world!” appear below it. This is DOM manipulation using javascript. Observe the code in the script tag. Inside the demoFunction, the getElementById method is used to access the id of a paragraph tag below. This is how “Hello world!” is added to the DOM dynamically.
Functions as First-Class Objects
Functions in javascript are objects. They can have properties and methods just like any other object. Functions can be passed as arguments in other functions. They can also be thrown as exceptions. This feature of javascript is widely popular. Functions as objects are very helpful in development. In the above code, function1 along with value is passed as an argument in function2. In the function2, function1, now as callback, is used. This is how functions are passed in javascript.
Javascript as a Client-Side Language
Originally developed as a server-side, javascript is also used as a client-side language. This feature of javascript made it the primary language of the web. A developer does not need to learn different programming languages for server-side and client-side because javascript can be used as both.
Platform Independent
Javascript is a platform-independent language, which means it can run on Windows, Macintosh, Netscape-supported systems, and any other platform.
The Syntax is Similar to Java
Javascript was developed as a companion to java. Javascript was not intended to have similar syntax as java. But further development forced it to do so. This made it easier for developers who work in both languages.
Date and Time
Not many programming languages support ways for handling date and time. Javascript has inbuilt functions that easily handles dates and time.
Prototype-Based Object Model
In javascript, the objects have an internal property known as the prototype. These prototypes are a reference to other objects and contain common properties across all instances of the object. Prototypes are extremely useful for developers and ease their work. This prototype-based model made javascript greatly flexible and influenced many useful libraries such as Stampit.
The following code shows the use of prototypes in javascript.
Form Validation
Forms play a very important in the modern web. The form is created using HTML but that’s not everything. Form need validation for user inputs that is necessary. Javascript handles form validation and sends data to the server with very ease.
Detecting the User’s Browser and OS
Although Javascript can run on every platform, there could be a need for browser and os specifications according to the code. Javascript is capable of detecting the user’s browser and OS.
Ability to Create Functions in the Script
This is one unique and useful feature of javascript. While writing scripts of any HTML document, a developer may need functions to handle an event and other stuff, javascript provides this option also. Functions can be created in scripts using the function keyword. The above HTML code has a script where a function is used.
JavaScript Usage in High Interactivity
JavaScript is an interpreted language that runs in many Web browsers. You can use it to customize browser behavior. Objects that represent the applet, business component, business service, and application object types exist in the browser address space as JavaScript objects and provide communication with the Siebel Server. These object types are the same object types that Siebel CRM instantiates in the browser. Initially, Siebel CRM passes these objects to the Siebel Web Engine, but also provides caching and other local processing. Siebel CRM uses the
following JavaScript objects:
Browser Applet. Provides a way to communicate and interact between applet controls.
Browser Buscomp. Provides a way to interact with business components. For example, the browser business component updates the state of browser applets as values that change in the underlying business component. These updates are due to master and detail views, calculated values, and certain behavior.
Browser Business Service. Provides a set of methods from browser scripts that you define. You can reuse a browser business service.
Browser Application. Provides a framework for Siebel CRM. In a browser application, you can create a method that is not specific to a business component or that calls a method on the Siebel Server.
JavaScript a programing language
JavaScript may be a programing language used primarily by Web browsers to make a dynamic and interactive experience for the user. Most of the functions and applications that make the web indispensable to modern life are coded in some sort of JavaScript.
Advantages of Javascript
Advantages and limitations of javascript
Java script is one of the core technologies of the World Wide Web. It is immensely popular because of its features. These features have many advantages that made java script this popular.
- Java script provides dynamic programming that is heavily used in the modern web.
- When used as a client-side language, Java script is very fast as it runs immediately in the browser.
- One does not need to master different languages for the client-side and server-side.
- The java script frameworks and libraries had made web development easy and straight-forward.
- Java script is very simple to learn as compared to other programming languages like java. Being one of the core technologies of the World Wide Web, resources for java script are easily available online and offline.
- Regardless of the file extension, We can insert java script in any web page.
- Java script supports all modern web browsers.
- Java script provides extended functionalities to the web pages.
- No compiler is needed in java script.
- Java script is an event-based programming language.