Javascript examples for Data Type:Number
Find the factor for an integer number
<html> <head></head> <body> <script> function factor(number, divisor, arr) { arr = arr || [];/* w w w. java 2s.com*/ if (divisor >= 1) { if (number % divisor === 0) { arr.push(divisor); return factor(number, divisor - 1, arr); } else { return factor(number, divisor - 1, arr); } } return arr; } console.log("factor of a number 36"); console.log(factor(36, 36)); </script> </body> </html>