-
Notifications
You must be signed in to change notification settings - Fork 0
/
04_01_funcao.html
34 lines (26 loc) · 987 Bytes
/
04_01_funcao.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<meta charset="UTF-8">
<script>
//a função sempre fica no início do script
function pulaLinha () {
document.write("<br>");
}
function mostra(frase) {
document.write(frase);
// podemos colocar a função de pular linha junto da função de escrever a frase
pulaLinha();
}
// o parâmetro irá receber o valor colocado quando charmarmos a função 'mostra'
var ano = 2018;
mostra("Flávio tem " + (ano - 1977) + " anos");
// document.write("Flávio tem " + (ano - 1977) + " anos");
// pulaLinha();
mostra("Joaquim tem " + (ano - 1996) + " anos");
// document.write("Joaquim tem " + (ano - 1996) + " anos");
// pulaLinha();
mostra("Barney tem " + (ano - 1976) + " anos");
// document.write("Barney tem " + (ano - 1976) + " anos");
ano = 2023;
// pulaLinha();
mostra("Luis tem " + (ano - 2022) + " anos");
// document.write("Luis tem " + (ano - 2022) + " anos");
</script>