What will happen if the below JavaScript code executed?
function isEqual(a, b){
if(a=b){
return true;
} else {
return false;
}
}
isEqual(10,5);
isEqual(1,3);
Is this code valid? Most of the developers do this kind of mistake. It will return true for all the values. Also, the value of variable 'b' will be assigned to the variable 'a'.
function isEqual(a, b){
if(a=b){
return true;
} else {
return false;
}
}
isEqual(10,5);
isEqual(1,3);
Is this code valid? Most of the developers do this kind of mistake. It will return true for all the values. Also, the value of variable 'b' will be assigned to the variable 'a'.