Last active
July 18, 2024 19:11
-
-
Save Luisgustavom1/64707a19c1540ae52215eecb881b19c7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Calcular { | |
somar(valor, salarioPessoas) { | |
let total; | |
if (total === undefined) { | |
valor = null; | |
} else if (valor > 0) { | |
total = valor; | |
for (let salario of salarioPessoas) { | |
if (salario > 0) { | |
total += salario; | |
} | |
} | |
} else { | |
total = 0; | |
} | |
return total; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment