Minimum steps to 1 to find minimum operations to transform n to 1
Your function is right. 

However, for dynamic programming I always propagate state n to all states n+1 (Forward). Your code calculates state n+1 from state n (Backward). In this case both methods are okay and it is mostly a personal preference. But in other cases the backward method may run into problems that state n is not yet calculated. 

function minStepstoOne2(n) {
  var steps = Array(n+1).fill(n);
  steps[1] = 0; 

  for(let i = 1; i &lt; n; i ++) {
    steps[i + 1] = Math.min(steps[i + 1], steps[i] + 1); 
    if (i * 2 &lt;= n)
      steps[i * 2] = Math.min(steps[i * 2], steps[i] + 1); 
    if (i * 3 &lt;= n)
      steps[i * 3] = Math.min(steps[i * 3], steps[i] + 1); 
  }
  return steps[n]; 
}