Feedback needed for Intermediate Algorithm Scripting - Smallest Common Multiple

Tell us what’s happening:
Describe your issue in detail here.
i want to know if my solution is proper and accepted for this algorithm or this solution is only passing the tests of this challenge and may fail in another tests for the same problem ?

  **Your code so far**
function smallestCommons(arr) {
// first step get range between arr two numbers (including arr two numbers )
function getRange(numOne,numTwo){
        let rangeArr=[];
                        for(let i=numOne;i<=numTwo;i++){
                        rangeArr.push(i); }
                      for(let i=numOne;i>=numTwo;i--){
                      rangeArr.push(i);  }
  return rangeArr;
// check for any number is dividable by each number in range with increasing the checked number by multiplication of arr[0]*arr[1]
let arrRange = getRange(arr[0],arr[1]);
let num =0;
let result;
      let isDividable = true;
              for(let i=0;i<arrRange.length;i++){
                     if(num%arrRange[i] !=0){ isDividable = false;  } 
              if(isDividable == true && num !=0)
              {   result=num;
              break;  }
return result;  

  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: Intermediate Algorithm Scripting - Smallest Common Multiple

Link to the challenge:

The code doesn’t look like it has any indentation. It is expected to indent the code neatly when asking for a code review (and include comments if needed to clarify)

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.