javascript find all odd between two numbers code example
Example 1: js difference between two numbers
var difference = function (a, b) { return Math.abs(a - b); }
Example 2: percentatge difference between two numbers javascript
function relDiff(a, b) {
return 100 * Math.abs( ( a - b ) / ( (a+b)/2 ) );
}
// example
relDiff(11240, 11192); //=> 0.42796005706134094
Example 3: javascript find all odd between two numbers
function oddNumbers(l, r) {
let arr = [];
while (l <= r) {
arr.push(l);
l += 1;
};
return arr.filter(n => n % 2);
}