main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function smallestCommons(arr) {

  var test;
  arr = arr.sort((a,b) => a - b);
  var lcm = arr[1];

  while(true){
    test = true;

    for(var j = arr[0]; j < arr[1]; j++){
      if(lcm % j !== 0){
        test = false;
      }
    }

    if(test){
      break;
      
    }
   lcm += arr[1];

  }

  return lcm;
}
smallestCommons([23, 18]);
Native Browser JavaScript