You can just increment the i
by 0.5
and you will get your expected output, there is no need for extra check here.
for (var i = min; i <= max; i+=0.5) {
/** * Generate our possible error scores */function generateErrorScores() { var min = 0, max = 100, multiplier = 0.5, list = []; // Loop between min and max, increment by multiplier for (var i = min; i <= max; i += 0.5) { list.push(i); } return list;}console.log(generateErrorScores())