Problem:
Call two arms equally strong if the heaviest weights they each are able to lift are equal.
Call two people equally strong if their strongest arms are equally strong (the strongest arm can be both the right and the left), and so are their weakest arms.
Given your and your friend's arms' lifting capabilities find out if you two are equally strong.
Issue:
My solution keeps showing false when all numbers are equal. For example, when >you = [10, 15] and friend = [10, 15], I'm getting false when it should be true. Sure it's user error over here. :)
function areEquallyStrong(yourLeft, yourRight, friendsLeft, friendsRight) {
var you = [yourLeft, yourRight];
var friend = [friendsLeft, friendsRight];
you.sort(), friend.sort();
console.log(you, friend)
if(you === friend){
return true;
}else{
return false;
}
}
Fixed, thank you!!
function areEquallyStrong(yourLeft, yourRight, friendsLeft, friendsRight) {
var you = [yourLeft, yourRight];
var friend = [friendsLeft, friendsRight];
you.sort(), friend.sort();
console.log(you, friend)
for(var i = 0; i < you.length; i++) {
if(you[i] !== friend[i])
return false;
}
return true;
}