Skip to content

Instantly share code, notes, and snippets.

@Luisgustavom1
Last active July 18, 2024 19:11
Show Gist options
  • Save Luisgustavom1/64707a19c1540ae52215eecb881b19c7 to your computer and use it in GitHub Desktop.
Save Luisgustavom1/64707a19c1540ae52215eecb881b19c7 to your computer and use it in GitHub Desktop.
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