Implement the function allTheSame
in helper.js
. It should accept 3 boolean parameters (x, y, z) and
- return
true
if x, y and z are the same (alltrue
or allfalse
) - return
false
otherwise
The function allTheSame
should not contain more than one if
statement
This task is part of the Full-Stack JavaScript Course
If you have any issues with it, you can ask for community help below the post
Feel free to help others if you’ve already solved the task
helper.js
export const allTheSame = (x, y, z) => {
return true;
}
solution.js
import { allTheSame } from './helper.js';
console.log(allTheSame(true, true, true)); // true
console.log(allTheSame(true, false, false)); // false
console.log(allTheSame(false, false, false)); // true