I need to make a comparison (if) between the value of an input with 2 properties of an object and if they match, enter the system.
function datosPersonal(usuario, correo, dni, contraseña) {
//Objeto Personal
this.usuario = usuario;
this.correo = correo;
this.dni = dni;
this.contraseña = contraseña;
}
var lauty = new datosPersonal('lauty', '[email protected]', '23232323', '123321');
var danielitax = new datosPersonal('danielitax', '[email protected]', '41111111', 'daniela123');
$('#goLogin').click(function(){
var user = $('#inputUser').val();
var pass = $('#inputPassword').val();
});
I did the one if like this:
$('#goLogin').click(function(){
var user = $('#inputUser').val();
var pass = $('#inputPassword').val();
if(user == user.usuario && pass == user.contraseña) {
alert('Logeado');
} else {
alert('Los datos no coinciden.')
}
});
In the if, when you put user.username user.password the variable user, I want you to take it, for the value entered in the input. That is my problem!