JSFiddle - React, Tailwind, and code Playground

by Durtto

JavaScript

function Pessoa() {
    var nome;
    var idade;
    var email;
    this.getNome = getNome;
    this.getIdade = getIdade;
    this.getEmail = getEmail;
    this.setNome = setNome;
    this.setIdade = setIdade;
    this.setEmail = setEmail;
    this.mostraValores = mostraValores;
    function getNome() {
        return nome;
    }
    function getIdade() {
        return idade;
    }
    function getEmail() {
        return email;
    }
    function setNome(_nome) {
        nome = _nome;
    }
    function setIdade(_idade) {
        idade = _idade;
    }
    function setEmail(_email) {
        email = _email;
    }
    function mostraValores() {
        return 'Nome :' + nome + 'Idade :' + idade + 'anos Email :' + email;
    }
}

var pessoa = new Pessoa();
pessoa.setNome("Rodrigo Lazoti");
pessoa.setIdade(26);
pessoa.setEmail("[email protected]");
alert(pessoa.mostraValores());