-
Notifications
You must be signed in to change notification settings - Fork 191
Expand file tree
/
Copy pathAgeSimple.js
More file actions
17 lines (15 loc) · 526 Bytes
/
AgeSimple.js
File metadata and controls
17 lines (15 loc) · 526 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function calculaIdade(anoAtual, anoNascimento) {
return anoAtual - anoNascimento;
}
function imprimeSePodeDirigir(anoAtual, anoNascimento) {
let idade = calculaIdade(anoAtual, anoNascimento);
if (idade >= 18) {
console.log(` sua idade é ${idade} você já pode dirigir`);
} else {
console.log(`sua idade é ${idade} você ainda não pode dirigir`);
}
}
let anoAtual = 2020;
let anoNascimento = 2005;
imprimeSePodeDirigir(anoAtual, anoNascimento);
//https://pt.stackoverflow.com/q/439808/101