how to redirect page using JavaScript

Redirect a Webpage using JavaScript

Sometimes you might move a webpage to some other location but you still have people going to the old one.  We are able to redirect the users to the new page using JavaScript.  To do this, we would start with your basic HTML page, we’ll …

Read More

for vs for in loops

For of vs For in JavaScript Loops

In JavaScript there are two kinds of for loops: for of and for in.  The difference can be seen when looping through arrays.  Let’s take this array for example: var greetings = [“Hi”,”Hey”,”Hello”] It’s just a normal array with three strings (words) in it called …

Read More

user input javascript training

How to get user input in JavaScript

There are times in JavaScript when you’ll need to get the user’s input so you can perform some sort of calculation with it.  One of the most used methods to get user input is the command document.getElementById(“someId”).value.  To use this you would first need a …

Read More

create javascript object

How to create a JavaScript Object

In JavaScript, there is a thing called an object.  It’s something that can contain a value that is equal to something else.  Those are called key/value pairs.  There’s a key that is equal to some value.  It’s a way that you can have a variable …

Read More