Javascript Tutorial

This JavaScript tutorial helps beginners and professionals to learn JavaScript easily. JavaScript Example with Online Editor We have given online editor option with each JavaScript example. So, you can edit any example and see the changed output.


Prerequisite To …

Read moreJavascript Tutorial

What is Javascript

JavaScript is a dynamic computer programming language. It is object-based scripting language i.e. lightweight and cross-platform. We can make our web page more lively and interactive, with the help of JavaScript. It was created by Brendan Eich at Netscape in 1995. ←Prev …

Read moreWhat is Javascript

Where it is Used

It is used to create interactive websites. It is mostly used for: Client-side validation. It has Dynamic drop-down menus. It Displaying date and time. Validate user input in HTML form before sending the data to a server. Build forms that …

Read moreWhere it is Used

Features of Javascript

JavaScript is an object-based scripting language. It is case sensitive language. It is light weighted. Every statement in JavaScript must be terminated with semicolon (;). ←Prev Next→

Javascript Advantages

JavaScript is an interpreted language. It requires no compilation process so no compiler is required. The browser interprets JavaScript as HTML tags. JavaScript is relatively easy language. Any person can learn it very easily. It is use to develop dynamic …

Read moreJavascript Advantages

Javascript Example

Try Now JavaScript can be implemented using JavaScript statements that are placed within the <script>…</script>.

Try Now JavaScript code can be written in 3 places in JavaScript Between the <body>……</body> tag of HTML. Between the <head>……</head> tag of …

Read moreJavascript Example

Javascript comment

JavaScript comments are used to explain JavaScript code. It is used to add information about the code, warnings or suggestions so that end users easily understand the code. Types of JavaScript comments Two types of JavaScript comments: Single-line Comment Multi-line …

Read moreJavascript comment

Javascript Variable

Variables are used to store values (name=”Ram”) or expressions (Sum=x+y). Before using of variable first we need to declare it. We use keyword var to declare a variable like this:

There are two types of variables: Local Variable Global Variable Local Variable– It is declared …

Read moreJavascript Variable

Javascript Data Types

It provides different data types to hold different types of values. There are two types of data types in Javascript. Primitive data types. Non-primitive data types. As we know that JavaScript is a dynamic type language, which means we don’t need …

Read moreJavascript Data Types

Javascript Operators

In JavaScript operators are symbol that are used to perform operations on operands. In simple words 3+2 is equal to 5. Here 3 and 2 are called operands and + is called the operator. Following are the operators used in JavaScript: Arithmetic Operators. Comparison …

Read moreJavascript Operators

Javascript If Else

JavaScript use a conditional statement which is used to perform different tasks according to the conditions. There are three forms of statements use in JavaScript. if Statement. if else Statement. if else if Statement. if statement The if statement is used in …

Read moreJavascript If Else

Javascript Switch Statement

The switch statement is used in JavaScript to execute one code in multiple conditions. It is same as else if statement but it is more convenient then repeated if..else..if statement. Syntax

NOTE: Break statement plays a dominant role in switch-case statements. …

Read moreJavascript Switch Statement

Javascript loop

The way of repetition will form a circle that’s why repetition statements are called loops. In some situations we use Loop statements to reduce the number of lines. It is mostly used in Array. There are 3 types of loops …

Read moreJavascript loop

JavaScript Function

An important part of JavaScript is the ability to create new functions within <script>…..</script> tag. To declare a function in JavaScript using function keyword. We call JavaScript function multiple times to reuse the code. Advantages of JavaScript functions Code reusability: We call function …

Read moreJavaScript Function

Javascript Object

An object is an entity having state and behavior. JavaScript is an object oriented scripting language. JavaScript is template based not class based but we can create object directly. Syntax to add property to add object

We use the write() method …

Read moreJavascript Object

Javascript array

Array are used to represent the group of elements into a single unit or consecutive memory location. Each and every element which is entering into the array is going to be stored in the array with the unique index starting …

Read moreJavascript array

Javascript String

String object works with series of characters. It is used to store and manipulate text. There are two ways to create string in JavaScript: String literal. Using new keyword. String literal By using double quotes string literal is created. Syntax …

Read moreJavascript String

Javascript Date

JavaScript Date In JavaScript Date Object is data type build into the JavaScript language. Data object are created with the new Date(). JavaScript Date instance that represents a single moment in time. JavaScript date object can only be instantiated by calling …

Read moreJavascript Date

Javascript Math

JavaScript Math Math is build-in object that has properties and methods for mathematical constants and functions. It allows you to perform mathematical tasks on numbers. Syntax varpi_val = Math.PI; varsin_val = Math.sin(30); Examples Math.pow() Math.pow(x,y) returns the value of x to the power of y: …

Read moreJavascript Math

Javascript Number

The Number object is a wrapper object which allows you to work with numerical values. The number object is created using the Number() constructor.It may be integer or floating-point. Syntax


Try Now Output

Description The primary uses of the number …

Read moreJavascript Number