Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // We'll say that a number is 'teen' if it is in the range 13..19 inclusive.
- // Given 2 int values, return true if one or the other is teen, but not both
- var loneTeen1 = function (a, b) {
- if ((((a >= 13) && (a <= 19)) && !((b >= 13) && (b <= 19))) || (((b >= 13) && (b <= 19)) && !((a >= 13) && (a <= 19)))) {
- return true;
- } else return false;
- }
- var loneTeen2 = function (a, b) {
- var aa = 0;
- var bb = 0;
- if ((a >= 13) && (a <= 19)) {
- aa = 1;
- }
- if ((b >= 13) && (b <= 19)) {
- bb = 1;
- }
- if (aa + bb === 1) {
- return true;
- } else if ((aa + bb === 2) || (aa + bb === 0)) {
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement