I am working with forEach statements right now and I have a block of code here that successfully executes what I am working on but I don't understand one particular statement. I did not write this code.
let test = [10, 12, 14, 15, 16, 18];
test.forEach(function(num, index, array) {
if (num % 3 === 0) {
array[index] = num += 100; // <- This is the line of code that I am confounded by
}
});
console.log(test);
I simply don't understand the logic behind it.
Sorry if the question is poorly phrased this is my first coding related question I've ever posted, thanks for the help.
num += 100is shorthand fornum = num + 100.