title: Is there any simplification for the following code?
body: <p>So I made this function that checks if x is a power of y and I was wondering if it could be written in a simpler fashion </p>
  
  <p>I've already done all I could do to simplify it but I was wondering if it could be simpler</p>
  
  <pre><code>  let IsPowerOf = (x, y) =&gt; {
    let l = x,
     n = 0;
    while (l % y == 0) {
      l / = y;
      n++;
    }
    if (Math.pow(y, n) == x)
      console.log(" true ");
    else
      console.log("false");
  };
  </code></pre>
  
  <p>it should still work if there are any simplifications made</p>