Guest User

Untitled

a guest
Jul 19th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. function onlyOne(input1, input2, input3){
  2. output = false;
  3. let truthy = 0;
  4. let falsey = 0;
  5. if (!!input1) {
  6. truthy++;
  7. } else falsey++;
  8. if (!!input2) {
  9. truthy++;
  10. } else falsey++;
  11. if (!!input3) {
  12. truthy++;
  13. } else falsey++;
  14. if (falsey > truthy) {
  15. output = true;
  16. }
  17. if (falsey > 2) {
  18. output = false;
  19. }
  20. return output;
  21. }
Add Comment
Please, Sign In to add comment