Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function smallestCommons(arr) {
- arr.sort((a,b)=>a>b?1:-1)
- let [div, num] = arr
- while(div < arr[1]){
- if(num % div===0) {
- div++;
- } else {
- num += arr[1];
- div = arr[0]
- }
- }
- return num;
- }
- console.log(smallestCommons([1,13]));
- //console.log(smallestCommons([23,18]));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement