I am trying to test some code and for that I need to make some tests in loop, like this:
for (var i = 1; i <= 5; i++) {
QUnit.test('Hello ' + i, (assert) => {
console.log(i);
assert.ok( 1 == '1', 'Result: ' + i);
});
}
Click here for working example at jsFiddle
But for some reason i in the loop (and result) is always 6, so this code gives me output like this:
6
6
6
6
6
What am I doing wrong?