So i just started learning javascript, I'm in the functions module now and I was playing around with it and suddenly i ran into a doubt:
why is this:
if(x==true){
 return 1;
}
different from this:
if(x){
 return 1;
}
?
You see, i have this code:
function isAdult(age){
    if(age >= 18){
        return true;
    }
    return false;
}
function nameAndAge(string, boolean){
    if(boolean == true){
        var my_string = string + " is adult";
        return my_string
    }
    var my_string = string + " is under age";
    return my_string
}
var talisa_age = 22;
var talisa_name = "Talisa Maegyr";
var status = isAdult(talisa_age);
var str = nameAndAge(talisa_name,status);
console.log(str)
and regardless of the "talisa_age" value i get the following output:
"Talisa Maegyr is under age"
however, if i chaged the nameAndAge's validation to
if(boolean){
        var my_string = string + " is adult";
        return my_string
}
the code works as intended...
 
    