Edit in JSFiddle

for (var i = 0; i < 5; i++) {
    console.log(i); // 0, 1, 2, 3, 4
}