Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onlyOne(input1, input2, input3){
- output = false;
- let truthy = 0;
- let falsey = 0;
- if (!!input1) {
- truthy++;
- } else falsey++;
- if (!!input2) {
- truthy++;
- } else falsey++;
- if (!!input3) {
- truthy++;
- } else falsey++;
- if (falsey > truthy) {
- output = true;
- }
- if (falsey > 2) {
- output = false;
- }
- return output;
- }
Add Comment
Please, Sign In to add comment