JavaScript: Check two given integer values and return true if one of the number is 15 or if their sum or difference is 15
JavaScript Basic: Exercise-45 with Solution
Check if Integer is 15, or Sum/Difference is 15
Write a JavaScript program that checks two integer values and returns true if either one is 15 or if their sum or difference is 15.
This JavaScript program evaluates two integer values to determine if either one is equal to 15 or if their sum or difference equals 15. If any of these conditions are met, it returns true; otherwise, it returns false.
Visual Presentation:

Sample Solution:
JavaScript Code:
Output:
true true true true false false false
Live Demo:
Flowchart:

ES6 Version:
For more Practice: Solve these Related Problems:
- Write a JavaScript program that checks if either of two integers is 15 or if their sum or difference equals 15.
- Write a JavaScript program that verifies if one of two numbers is 15 or if combining them by addition or subtraction results in 15.
- Write a JavaScript program that takes two integers and determines if one is 15 or if their sum/difference is 15, returning a boolean.
Improve this sample solution and post your code through Disqus.
Previous: JavaScript program to check from three given integers that if a number is greater than or equal to 20 and less than one of the others.
Next: JavaScript program to check two given non-negative integers and if one of the number (not both) is multiple of 7 or 11.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics