Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Pessoa {
- constructor(altura, massa) {
- this.altura = altura;
- this.massa = massa;
- }
- get imc() {
- return this.massa / (this.altura ^ 2)
- }
- }
- const mark = new Pessoa(1.70, 75);
- const john = new Pessoa(1.90, 89);
- console.log(`A massa de Mark e John tem a diferença de: ${(mark.massa - john.massa).toPrecision(3)}
- IMC de Mark: ${mark.imc.toPrecision(4)}
- IMC de John: ${john.imc.toPrecision(4)}
- O IMC de Mark é maior que o de John? ${mark.imc > john.imc}`);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement