i want to ask how do i make that the generator would break when it generates a number that is even using cycles and arrays. I tried to do it using if (i%2) {break} , but it does not work for me. Also can you help me to put all the negative number generated to the arrays end ? Thank you for the help. This is my javascript code
<script>
var text = "";
let mas = [];
const y = 200;
const y1 = -20;
for (let i = 0; i != 15; i++) {
mas.push(Math.floor(Math.random() * y) + y1);
mas.sort();
}
document.getElementById("demo").innerHTML = mas;
</script>