var a = [1, 2, 3, 4, 5, 6, 7, 8];
sum = [];
array = parseInt(10 * Math.random());
for (var j = 0; j < 3; j++) {
for (var i = 0; i < a.length; i++) {
sum[i] = a[i];
if (i == array) {
break
};
}
console.log(sum);
}
break can be removed...
The juli[b] in the loop cannot be added to the array correctly every time
If the conditions are met, I will use break to interrupt
If the subscript obtained by acc reaches 5, sum the first 1234 and so on
**1.0374510479565615 "The shortest distance between the point and the line" (index):84
[736260.8899769672, 1411419.6883407037] "The vertical coordinates" (index):102
17.38691589480421 "The distance from the nearest point" (index ):104
[13.999781212443958, 54.4198045292843 70.38912223496114 880968758, 646.6167989543939, 313.57803581242166, 1067.5293031990727, 958.2300622502552, 417.420483917605, 64.57688332512566 , 216.4881564657956, 316.1135609002259, 81.2835112492013, 56.39033259343886, 561.7188548465188, 142.39781082935613, 893.5690 953081938, 92.02929710155902, 16.993059288952495, 14.314772824074824, 14.785963614054475, 20.720394204841156, 29.40872826215661, 22.45736237849337, 19.645029625828716, 28.46256518660203, 41.71105215644795, 18.333020182101933, 16.940 88291682246, 32.23066924532746, 14.250265576472243, 204.50641699722792, 20.740160172962312, 24.035660943608878, 13.999781212 62 .58699880968758, 646.6167989543939, 313.57803581242166, 1067.5293031990727, 958.2300622502552, 417.420483917605, 142.39781 082935613, 893.5690953081938, 92.02929710155902, 16.993059288952495, 14.314772824074824, 14.785963614054475, 20.720394204841 156. 94088291682246, 32.23066924532746, 14.250265576472243, 204.50641699722792, 20.740160172962312, 13.999781212443958, 54.4198045292843 70.38912223496114 880968758, 646.6167989543939, 313.57803581242166, 1067.5293031990727, 958.2300622502552, 417.420483917605, 64.57688332512566 , 216.4881564657956, 316.1135609002259, 81.2835112492013, 56.39033259343886, 561.7188548465188, 142.39781082935613, 893.5690 953081938, 92.02929710155902, 16.993059288952495, 14.314772824074824, 14.785963614054475]**