Console.log() interrupts for loop?

Hello everybody,
It’s my first post. I completed the responsive web certification and am almost done with the javascript one. I have previous experience with C and Phyton (studied Physics at the university).

I have a code that stops working if I use a consol.log(“hello”); in the middle of a for loop. Without the console.log("hello); it works. I would like to understand why. I am not able to figure out why myself. Can someone help me to understand? Thanks

It’s about one of the challenges:

And the code is:

function smallestCommons(arr){

  var max = Math.max(arr[0], arr[1]);
  var min = Math.min(arr[0], arr[1]);
  var mltple = max;

  for(var i = max; i >= min; i--){
    if(mltple % i !== 0){
      mltple += max;
      i = max;
  return mltple;  

smallestCommons([23, 18]);
SyntaxError: unknown: Unexpected character '–'. (7:31)

   5 |   var mltple = max;
   6 |
>  7 |   for (var i = max; i >= min; i–) {
     |                                ^

Thank you very much! It makes sense.

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