Equality of 3 Values
THE CHALLENGE
Create a function that takes three integer arguments (a, b, c) and returns the amount of integers which are of equal value.
Please notice that I use print in the code instead of console.log to show the result in my built-in console below. However, you should use console.log to
show the result in your normal console
THE CODE
// WEEK 5 → DAY 2
// Equality of 3 Values
function equal(a, b, c) {
if (a === b && a === c) {
return 3;
}
if (a === b || a === c || b === c) {
return 2;
} else
return 0;
};
print(
equal(
prompt("Enter the first number"), prompt("Enter the second number"), prompt("Enter the third number")
)
);
THE EXECUTION RESULT