function getRelationship(x, y) {
// Below the first if conditions check whether the values entered are of number types
if (isNaN(x) && isNaN(y)){
return("Can't compare relationships because" + ' ' +x+ ' ' + "and"+ ' ' +y+ ' ' +"are not numbers");}
if (isNaN(y)) {
return ("Can't compare relationships because"+ ' ' +y+ ' ' +"is not a number");}
if (isNaN(x)){
return ("Can't compare relationships because"+ ' ' +x+ ' ' +"is not a number");}
//These next if conditions check whether value is bigger, smaller or equal to value2
if (x > y) {
var rel=">";
return(rel);}
if (x < y) {
var rel2="<";
return(rel2);}
if (x === y) {
var rel3="=";
return(rel3);}
}
// Try logging these functions to test your code!
console.log(getRelationship(1,4));
//console.log(getRelationship(1,1));
//console.log(getRelationship("that",2));
//console.log(getRelationship("this"," something else"));
//console.log(getRelationship(3));
//console.log(getRelationship("hi"));
//console.log(getRelationship(NaN));
//console.log(getRelationship(NaN, undefined));
function getRelationship(x, y) {
// Below the first if conditions check whether the values entered are of number types
if (isNaN(x) && isNaN(y)){
return("Can't compare relationships because" + ' ' +x+ ' ' + "and"+ ' ' +y+ ' ' +"are not numbers");}
if (isNaN(y)) {
return ("Can't compare relationships because"+ ' ' +y+ ' ' +"is not a number");}
if (isNaN(x)){
return ("Can't compare relationships because"+ ' ' +x+ ' ' +"is not a number");}
//These next if conditions check whether value is bigger, smaller or equal to value2
if (x > y) {
var rel=">";
return(rel);}
if (x < y) {
var rel2="<";
return(rel2);}
if (x === y) {
var rel3="=";
return(rel3);}
}
// Try logging these functions to test your code!
console.log(getRelationship(1,4));
//console.log(getRelationship(1,1));
//console.log(getRelationship("that",2));
//console.log(getRelationship("this"," something else"));
//console.log(getRelationship(3));
//console.log(getRelationship("hi"));
//console.log(getRelationship(NaN));
//console.log(getRelationship(NaN, undefined));