Compiler Problem

How are you guys, I hope you are having a good day.

I have a weird problem that is i’m facing right now and I want to ask you: did you experience this problem before ?

When I am coding I use an online code editor called playcode.io and then I transfer my solution to FCC editor and submit it. The problem I am facing right now (in intermediate Javascript algorithm section) is that when I solve the problem in playcode.io and making sure the result is ok, when I transfer it to the FCC editor I find another result which is really weird.
Did anyone experience that before ?

an example: Intermediate Algorithm Scripting: Smallest Common Multiple:
As stated in the example section: smallestCommon([1, 13]) should return 360360
playcode.io: my solution show the same result = 360360.
FCC editior: the same solution give me = 113211

  1. Can you provide your code?
  2. Are you by any chance using a global variable?
function smallestCommons(arr) {
  let array = [];
  let num1, num2;
  let counter = 0;
  let result;
  let zeroLength;
   
  if(arr[0] > arr[1]){
    num1 = arr[1];
    num2 = arr[0];
  }
  else{
    num1 = arr[0];
    num2 = arr[1];
  }
  
  for(let i = num1 ; i <= num2; i++){
    array.push(i);
  }

  while(zeroLength !== array.length){
    counter++;

    result = array.map(
      (x) => (counter % x)
    );
    
    zeroLength = result.filter(
      (x) => (x === 0)
    ).length;
  }
  
  return counter
}

console.log(smallestCommons([23, 18]));

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.

markdown_Forums

You may just be triggering FCC’s infinite loop protection. Accidentally creating infinite loops that can crash your browser is a common mistake by new programmers. To prevent your browser from crashing, FCC will stop executing your code after a certain amount of time. If your solution runs slowly it can fail to complete for this reason.