s
function hasSameRightmostDigit(num1, num2,num3) {
// Get the rightmost digits of the two numbers.
const rightmostDigit1 = num1 % 10;
const rightmostDigit2 = num2 % 10;
const rightmostDigit3 = num3 % 10;
// Return true if the rightmost digits are the same, false otherwise.
return rightmostDigit1 === rightmostDigit2 && rightmostDigit2 === rightmostDigit3;
}
console.log(hasSameRightmostDigit(12,22,22));
</script>
s
No comments:
Post a Comment