Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

How to write a custom directive for password and confirm-password validation

A custom Directive helps us to control the rendering of the HTML inside an AngularJS application. It makes AngularJS responsive. Here is a custom directive to check for password and confirm password validation: angular.module('app') ...

Splitting a String in javascript

To split a string in javascript, we use split() method which splits the string into an array of substrings. Syntax: string.split(separator); Where separator specifies the character(s) to use for separating the string, and if this separat...

JavaScript String charAt() Method

JavaScript String charAt() Method This method is used whenever we want to Return the first character of a string for example: var str = "PRANAV CHHABRA"; var v = str.charAt(0); Result: P Now below is the full example to illustrate ch...

add() method in Javascript

add() Method The add() method is used to add an option in a drop-down list. This simplifies the work of user whenever it is required to add element or option. below is the example of add() method which is used in dropdown menu and gives the ...

Javascript Array Properties and Methods

Basically Array is used to store multiple values in a single variables(only store a fixed size sequential collection of same type of element) . Syntax -> var names = new Array( "Mukesh" , "Ravi"); Parameter of an Array can be a list...

Javascript Access the Elements of an Array

In an Array , elements are zero-indexed i.e first element of an array is at index 0 and the last element is at the index equal to the value of array length minus 1 (array.lenght-1) Example -> var name = [ ' first ' , ' second '] ; consol...

Do While Loop in Javascript

Do While loop Executes a statement once, and then it repeats the execution of the loop until a condition expression becomes false. The do while loop consist- do { statement } while (expression) ; statement--> The statement t...

How to convert Array into a String in JavaScript

Conversion of array into a string in JavaScript. There are two method to convert element of array into a string in JavaScript. 1st Method: toString()-> toString() method joins the array & returns one string that contain each element ...

Javascript Looping Array Elements

Basically Javascript previous version ES5(script 5) support three loops and new version ES6(script 6) version support two more loops i.e for-of loop (ES6 ) and an iterator (ES6) . 1) for each loop for each() method iterates the speci...

Understanding scope in Custom Directive

There are three types of scopes used in a Custom Directive:- 1. Shared scope 2. Inherited scope 3. Isolated scope 1. Shared scope:- Directives share the scope within that controller, in a shared scope. Since a new scope is not...

Javascript Comparing For and While Loop

JavaScript Comparing For and While Loop Both the loops are similar in some ways, like both are used for repeated execution of statements as well as execution are done till the condition is true. For loop and while loop they differ by the sy...

JavaScript Math Object

JavaScript Math Object The JavaScript math object is used to perform mathematical operation. The Math object includes several mathematical methods. Below are certain math objects with examples: 1)Math.sqrt(n) this method returns the squa...

How confirm and match the password fields on a html form

Hello Reader!, If you looking for a front end validation for matching the two passwords feilds with Javascript then you can see how to get it done. Lets consider the example below Here i'm using the html code for the form <form clas...

Javascript Adding Array Elements

In Javascript you can add one or more element into an array with the hepl of push() method and it will return new length of an array . Syntax -> arrayname.push(element1, element2 ,.........elementN ) Parameters -> elementN- > New El...

Javascript Debugging

JavaScript Debugger is very important in javascript because It is difficult to write JavaScript code without a Debugger Your code might contain syntax errors, or logical errors, that are difficult to diagnose. There are no indications f...

Add remove form fields dynamically

In this example user will have facility to add more input fields in form dynamically similarly user will also have facility to remove dynamic input fields so once user click remove link it removes the current input field by using its correspond...

Javascript: How to Recognize if a variable is an array?

In Javascript there are several ways to detect array(variable is an array). But through this post , I will tell you ony four different ways to detect variable is an array . Below there are 4 different ways are :-> 1) Array.isArray(object) ...

How to make Fancy Box on your text portion

Hello reader! if you having the page and need to show the fancy loading on any text portion then you can see the code below. For the loader and the text the css will go like this #dummy { display: none; } #target { display:inl...

How to improve performance of a AngularJS app

Hello readers if you using a long Angular JS app and want to make it's performance better you can see here how to make your app efficient There are two ways of achieving this for a developer namely 1. disabling debug data and 2. enabling stric...

Deleting Elements using Javascript

In Javascript , you can't delete the element directy if you want to delete the element , then first you have to find its parent element and delete it using remove() method .Because DOM ( Document Object Model ) doesn't support removing an eleme...

Using splice() to Remove Elements in Javascript

Basically splice() method is used to change the content of an array by removing existing element and add new elements . It contain three parameter start , deletecount and ItemN. start ->It is the position where to start the selection .And i...

Difference between 'null' and 'undefined'

The difference between undefined and null is as follows, 1-When we declare any variable and we do not give it a value then it will have the value undefined.Undefined is a type all to itself 2- We can declare a variable and can set it to n...

Javascript math.min() and math.max() function

JavaScript min() Method This method returns number with lowest value Here is the example of math.min() <p>Click the button to return the lowest number of 5, 10,2,0.</p> <button onclick="myFunction()">re...

Local JavaScript Variables

Local JavaScript Variables A variable declared inside a function has the scope only in that function, thus the variable is the local variable. The variable doesn't have any recognition out side the function definition. Local variables sco...

Operator in Javascript

There are following types of operators in JavaScript. 1- Arithmetic Operators ( +,-,*,/,%,++,-- ) <script> var a= 1; var b = 2; var c = a + b; document.getElementById("demo").innerHTML = c; </script> 2- Comparison (Rel...

Javascript Undefined Values

Javascript Undefined Values In a program the variables declared gets the value at the time of the variable declaration or get assigned after some calculation or received by the user input, but the variables which are not assigned any value at ...

JavaScript objects

A javaScript object is an entity having state and behavior. For example: car, pen, bike, chair, glass, keyboard, monitor etc. Objects are real world entity. JavaScript is an object-based language. Everything is an object in JavaScript. Ther...

JavaScript Assignment Operators

JavaScript Assignment Operators The Assignment Operator is used to assign the value of the right operand to the left operand. The key rule for this operator is that it always assign value from right to left. The Assignment operator (=) work...

Javascript () Operator Invokes the Function

Javascript () Operator Invokes the Function During the call of the function the code of the function gets executed. the call to the function can be made by the name of the function followed by the parentheses (). example: func(1,2); ...

Slicing an Array

Basically slice() method is used to extract some particular elements from an original array (suppose i need to show only selected elements from original array). It contain two parameter start/begin and end. begin ->It is the position where t...

Javascript length property

Javascript length property is used to find out the length of characters or it may returns number of elements in an array Every Character gets counted in this property. JavaScript Array length Property The length property returns the number ...

JavaScript Function Syntax

JavaScript Function A function is a separate part of the program that performs a particular task. The code of the function can be reused by calling the same function wherever it is required to perform the same task. A function syntax is a...

While-loop in Javascript

The JavaScript while loop iterates the elements for the infinite number of times. It should be used if number of iteration is not known. The syntax of while loop is given below- while (condition) { code to be executed } Below i...

Sorting array in Javascript

Sorting is the process of arranging elements systematically either ascending or descending order. The main purpose of sorting information is to optimise its usefulness for specific tasks. Sorting arranges data in a sequence by which searching b...

Display array inside a paragarph tag

using javascript

Java Script arrays are used to store more than one values in a single variable. In the below given example we will use script to display array (var= names) data inside a <p> (paragraph) tag of HTML with id="display". <!DOCTYPE html>...

JavaScript else if Statements

In JavaScript , the correct syntax for elseif is "else if" not "elseif". else if statement is used where we have to check multiple statement. Example : var eating; if(eating < 8){ document.write("Time to take brunch"); } else if(gre...

Javascript Loops

The JavaScript loops are used to iterate the piece of code.We have for, while, do while loops. It makes the code compact. Looping is what makes computer programming worthwhile. There are three types of loops in JavaScript. 1)for loop 2)w...

Javascript Shifting Elements

The shift() method is used to remove the first element of an array from the zero index and shift to the consecutive index and this is also used to change the length of an array . syntax : array.shift(); Example : var arr = ['Mukesh', 'Ayu...

Javascript getDay() method

JavaScript getDay() Method Return the day of the week: var d = new Date(); var n = d.getDay(); This method is used for getting the days of week from 0-6 for the date specified. in this 0 stand for sunday and 1 stand for monday. Synt...

Javascript and If Else statement

If else statement like any other computer language are used for condition. If the condition satisfies it goes for first statement and if it does not than it goes for the second statement. 1.if is use to run a code if a condition is true. 2.el...

How to define global variable in JavaScript ?

Hi friends, As we know that if we declared a variable outside the function of javascript, then it is said to be global variable. But this is not a correct way to declare global variable. Correct way to declare global variable in JavaScript is-...

Javascript Datatype

Javascript data type can hold may data type like number string arrays object and other. To declare a variable we use var keyword example var length = 16; // Number var lastName = "Johnson"; ...

JavaScript Initializing Arrays

How to create an array in JavaScript? Before going for the above question we should be clear about What is an Array? An array is a sequential collection of variables or we can say an array is a special variable, which can hold more than on...

Re-Declaring JavaScript Variables

In javascrit,if you re-declare a variable, it wouldn't lose it value. Example -> var a=10; var a; alert(a); Output : 5 Here you can see, in JavaScript the output will be same but in other languages result would be undefined o...

Javascript Switch Statement

The JavaScript switch statement is used to execute one code from multiple expressions. It is just like else if statement. But it is convenient than if..else..if because it can be used with numbers, characters etc. Syntax: switch(expression)...

Javascript Comments

Javascript Comments Comments like in any other computer language are used for making the code understandable ie explaining the code in simple language. They are not executed by the javascript. There are two ways to enter the comments 1. Sin...

Javascript arithmetic

Arithmetic operators perform arithmetic on numbers or literals or variables. 1) + addition 2) - subtraction 3) * multiplication 4) / division 5) % modulus 6) ++ increment 7) -- decre...

Javascript typeof Operator

The typeof Operator : typeof is a kind of keyword that returns a string which tells the data type of an expression. Syntax : `typeof operand` (The operand used is an expression representing the object or primitive whose type is to be re...

Javascript variables

A JavaScript variable is simply a name of storage location. There are two types of variables in JavaScript : local variable and global variable. There are some rules while declaring a JavaScript variable:. 1)Name must start with a letter (a...

Basic Program of Java Script

JavaScript is the programming language of HTML and the Web. JavaScript can be placed in the and the sections of an HTML page. In HTML, JavaScript code must be inserted between and tags. <!DOCTYPE html> <html> <head> ...
1 25 31
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: