I struggle to understand the function below. I didn't know why my script wasn't working until I changed = with === in the if statement, as shown below. Why does === work while = doesn't?
var testTest = function(answer) {
    if (answer === "doggies") {
       return "My favorite animal!";
    } else {
       return "Tested";
    }
};
testTest("doggies")
When I type doggies, it shows me My favorite animal! With anything else, it returns Tested as it should.
However, when I change the === in the if statement with =, the else part doesn't work.
var testTest = function(answer) {
    if (answer = "doggies") {
       return "My favorite animal!";
    } else {
       return "Tested";
    }
};
testTest("elephant")
 
     
     
     
    