created a for loop in JavaScript