Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. function cadastrarUsuario() {
  2.  
  3.  
  4. let nome = document.querySelector("#nome").value;
  5. let nota1 = document.querySelector("#nota1").value;
  6. let nota2 = document.querySelector("#nota2").value;
  7. let nota3 = document.querySelector("#nota3").value;
  8. getAprovado(nota1, nota2, nota3);
  9. criarUsuarioTable(nome,nota1,nota2,nota3)
  10.  
  11. }
  12.  
  13. function getAprovado(nota1, nota2, nota3) {
  14.  
  15. console.log('numero um ',nota1)
  16. console.log('numero dois ',nota2)
  17. console.log('numero tres ',nota3)
  18. let media = (nota1 + nota2 + nota3) / 3;
  19.  
  20.  
  21. if (media >= 7) {
  22. alert('Aprovado')
  23. } else {
  24. alert('Reprovado')
  25. }
  26. }
  27.  
  28. function criarUsuarioTable(nome,nota1,nota2,nota3){
  29.  
  30. let html = document.querySelector("#tabela");
  31.  
  32. html.innerHTML =
  33. `
  34. <tr>
  35. <td>${nome}</td>
  36. <td>${nota1}</td>
  37. <td>${nota2}</td>
  38. <td>${nota3}</td>
  39. <td>${(nota1+nota2+nota3)/3}</td>
  40.  
  41. </tr>
  42.  
  43. `
  44. }
  45.  
  46. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement