Короче ... все.
Я так понимаю, вы новичок в JavaScript и программировании? Вам нужно много читать, чтобы понять область действия объекта и то, как работает javascript. Я кратко расскажу о том, что вы написали, чтобы вы могли кое-что узнать.
// Here you're declared two objects. 'emailExists' and 'userExists'.
// These Boolean objects, since they are not wrapped in a closure are now global
// (you can reference them anywhere) in your script.
var emailExists = false;
var userExists = false;
// This function never gets called. If it did, it would always return true
// since you have created a new 'emailExists' Boolean object in your function
// and would return that each time.
function checkExisting(emailExists,userExists) {
// This whilst only available within the function closure, is a no, no.
// You're just confusing things by creating objects with the same name
// as global ones.
var emailExists = true;
// I'm returning true.
return emailExists;
}
// Here you are returning your first declared Boolean (the one at the top)
// this will always return false.
alert(emailExists);