I don't understand why the below code doesn't log 1 and 2 and then return false. Doesn't the return break out of the forEach scope and firstLayer's scope to return false? Right not it's not even breaking the forEach scope.
var arrayExample = [1,2,3];
function firstLayer (arr) {
arr.forEach(function (num) {
console.log(num);
if (num === 2) {return false;}
});
return true;
}
firstLayer(arrayExample);
//logs 1,2,3 and returns tru
e