Compare commits

...

2 Commits

View File

@ -59,6 +59,29 @@
uma array contendo 40 numeros aleatórios, retornar somente os números uma array contendo 40 numeros aleatórios, retornar somente os números
pares divisíveis por 5, faça isso em javascript. pares divisíveis por 5, faça isso em javascript.
</p> </p>
<script></script> <script>
// array
// 40 length
// radom numbers
// return par / 5
function paresPor5() {
const numbers = [];
for (let i = 0; i < 40; i++) {
let numb = Math.floor(Math.random() * 100)
numbers.push(numb);
};
console.log(numbers);
const pares5 = []
numbers.forEach(element => {
if (element % 2 === 0 ) {
if (element % 5 === 0) {
pares5.push(element)
}
}
});
console.log(pares5);
}
paresPor5();
</script>
</body> </body>
</html> </html>