【JS-Bug集合】Uncaught SyntaxError: Illegal break statement
下面是出现错误的代码:1.functiongetSum(arr){varsum=0;arr.forEach(a=>{sum+=a;})if(sum>10)break;returnsum}arr=[1,2,3,4,5,6];sum=getSum(arr)2.functiongetSum(arr){varsum=0;arr.forEach(a=>{sum+=a;if(sum>10)break;})r