Javascript For Loop

In some cases we may need to complete a task in loop. To handle such situation, we have for loop in Javascript. For Loop Lets begin with an example to understand the need of “for loop” Example Lets print 1 to 10 Solution: <script> var num=1; console.log(num); num++ // incremented the value by 1 console.log(num); num++ // […]

Javascript If Else Statement

Before proceeding further lets first understand why if else if statement requirement came? Lets consider the simple situation, login process. A user is only allowed to access web pages of a website, if the user has logged in with valid credentials. See in the above case, “if” logic is there. Logic for login is as […]

Javascript Assignment Operators

To better understand what is an assignment operator, lets re-think once again how do we declare a variable and set value to it? Read Article: Variable Declaration in Javascript Assignment Operator The symbol of assignment operator is = Example <script> var num=100; </script> In the above example, we have declared variable name num. It holds the […]

Javascript Arithmetic Operators

To perform arithmetic operations Javascript has operators that performs the task. Operators Addition Operator As the name says, arithmetic operator performs arithmetic operation. The symbol of addition operator is + Example <script> var num1=10; var num2=20; alert(num1+num2); </script> Output:30 Subtraction Operator Subtraction Operator performs subtraction operation. The symbol of subtraction operator is – Example <script> var num1=20; var num2=10; alert(num1-num2); </script> […]

Javascript Different Types of Data Types

In previous chapter, we have learned by using identifier “var” we declare variable. By using assignment operator we assign data to the declared variable. Unlike Java, .Net, C# we do not require keyword to define the datatype. Javascript compiler can understand the datatype from the assigned value. Now the question is, what kind of data […]

Javascript Variable Declaration

Variables are essential for data storing in memory and utilising as per requirement. Variable is a container. In this container we can store data. Variable Declaration To declare a variable in javascript, we use identifier “var” followed with a name. Alike any programming language such as java, .net, c# etc. the statement must end with […]