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

Javascript Dialog Box

JavaScript Dialog Box A JavaScript dialog box is predefined function which is used to perform different task. Some functions are used in JavaScript Dialog box. Function Description alert() To give alert message to user prompt() To input value from used …

Read moreJavascript Dialog Box

Javascript Window Object

JavaScript Window Object The window object represents a window in browser. An object of window is created automatically by the browser. Window is the object of browser, it is not the object of JavaScript. The JavaScript objects are string, array, data etc. …

Read moreJavascript Window Object

Javascript Document Object

JavaScript Document Object Document object represents the whole HTML documents. When HTML document is loaded in browser it becomes the document object. It is the root elements that represent the HTML documents. With the help of document object, we can add dynamic content …

Read moreJavascript Document Object

Javascript Event

JavaScript Events Events are things that happen, usually user action, that are associated with an object. All object have properties and methods. Some objects also have events. The event handler is a command that is used to specify actions in response to an …

Read moreJavascript Event

Javascript Cookies

JavaScript Cookies Cookie is a piece of data which is sent from a website and stored locally by the user’s browser. Cookie is needed because HTTP is stateless protocol. Today most of the websites uses cookie. Cookies is the most …

Read moreJavascript Cookies

Javascript getElementByID

JavaScript getElementById The document.getElementById() method returns the element of specified id. In below example we receive input field by using document.getElementById() method, here document.getElementById() receive input value on the basis of input field id. Example

Try Now Code Explanation varnum=document.getElementById(“number”).value; In …

Read moreJavascript getElementByID

Javascript Forms Validation

JavaScript Forms Validation Form validation works at server, after client had entered all the necessary details and then pressed submit button. JavaScript provides the facility to validate the form on the client side so processing will fasterthan server-side validation. So …

Read moreJavascript Forms Validation

Javascript Password Validation

JavaScript Password Validation Here we see that how to validate any password field. Like password field can be blank and length of password is minimum 8 characters. Example

Try Now ← Prev Next →

Javascript Re-Password Validation

JavaScript Re-type Password Validation Example

Try Now ← Prev Next →