Javascript with Cookies

java script

Cookie is simply a variable that your webpage can store on or retrieve from the user’s computer to host machine. Examples of cookies could be: First time the visitor arrives the name is entered.(for example “John Wayne”). The username is then stored in a cookie. Next time he arrives at your page, it writes something … Read more

JavaScript for…in loop

java script

The for…in loop is used to loop through an object’s properties. As we have not discussed Objects yet, you may not feel comfortable with this loop. But once you understand how objects behave in JavaScript, you will find this loop very useful. Syntax for (variablename in object){ statement or block to execute } In each … Read more

JavaScript – For Loop

java script

The ‘for’ loop is the most compact form of looping. It includes the following three important parts − The loop initialization where we initialize our counter to a starting value. The initialization statement is executed before the loop begins. The test statement which will test if a given condition is true or not. If the … Read more

JavaScript – While Loops

java script

While writing a program, you may encounter a situation where you need to perform an action over and over again. In such situations, you would need to write loop statements to reduce the number of lines. JavaScript supports all the necessary loops to ease down the pressure of programming. The while Loop The most basic … Read more

JavaScript – Switch Case

java script

You can use multiple if…else…if statements, as in the previous chapter, to perform a multiway branch. However, this is not always the best solution, especially when all of the branches depend on the value of a single variable. Starting with JavaScript 1.2, you can use a switch statement which handles exactly this situation, and it … Read more

JavaScript if else Statement

java script

While writing a program, there may be a situation when you need to adopt one out of a given set of paths. In such cases, you need to use conditional statements that allow your program to make correct decisions and perform right actions. JavaScript supports conditional statements which are used to perform different actions based … Read more

JavaScript Control Structures (Loops and Branches).

javascript

JavaScript supports the following forms of if..else statement − if statement if…else statement if…else if… statement. if statement The if statement is the fundamental control statement that allows JavaScript to make decisions and execute statements conditionally. Syntax The syntax for a basic if statement is as follows − if (expression){ Statement(s) to be executed if … Read more

JavaScript Control Structures (Loops and Branches)

javascript

JavaScript supports the following forms of if..else statement − if statement if…else statement if…else if… statement. if statement The if statement is the fundamental control statement that allows JavaScript to make decisions and execute statements conditionally. Syntax The syntax for a basic if statement is as follows − if (expression){ Statement(s) to be executed if … Read more

Javascript Type of Operator

java script

The typeof operator is a unary operator that is placed before its single operand, which can be of any type. Its value is a string indicating the data type of the operand. The typeof operator evaluates to “number”, “string”, or “boolean” if its operand is a number, string, or boolean value and returns true or … Read more