Practice Set - Truth, Equality & JavaScript

by subsari

JavaScript

function compareCoercionDoesntWork(){
	var a = 6;
	var b = "ten"; 
	
	if (a < b || b < a) {
		alert("this is true!");
	}
}
compareCoercionDoesntWork();

function compareCoercionDoesWork(){
	var a = 6;
	var b = "10"; 
	
	if (a < b || b < a) {
		alert("[function compareCoercionDoesWork] this is true!");
	}
}
compareCoercionDoesWork();