Advertisement
Guest User

Untitled

a guest
Jan 17th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Pessoa {
  2.     constructor(altura, massa) {
  3.         this.altura = altura;
  4.         this.massa = massa;
  5.     }
  6.     get imc() {
  7.         return this.massa / (this.altura ^ 2)
  8.     }
  9. }
  10. const mark = new Pessoa(1.70, 75);
  11. const john = new Pessoa(1.90, 89);
  12.  
  13. console.log(`A massa de Mark e John tem a diferença de: ${(mark.massa - john.massa).toPrecision(3)}
  14. IMC de Mark: ${mark.imc.toPrecision(4)}
  15. IMC de John: ${john.imc.toPrecision(4)}
  16. O IMC de Mark é maior que o de John? ${mark.imc > john.imc}`);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement