src/02-numbers-tasks.js
/**
 * Returns the number rounded to specified power of 10.
 *
 * @param {number} num
 * @param {number} pow
 * @return {number}
 *
 * @example:
 *   1234, 0  => 1234
 *   1234, 1  => 1230
 *   1234, 2  => 1200
 *   1234, 3  => 1000
 *   1678, 0  => 1678
 *   1678, 1  => 1680
 *   1678, 2  => 1700
 *   1678, 3  => 2000
 */
Returns the number rounded to specified power of 10.


Returns the number rounded to specified power of 10 .
function roundToPowerOfTen(num, pow) {
  if (pow === 0) return num;
  const p = 10 ** pow;
  return ((Math.round(num / p)) * p);
}
function roundToPowerOfTen ( num , pow ) { if ( pow === 0 ) return num ; const p = 10 ** pow ; return ( ( Math . round ( num / p ) ) * p ) ; }
Returns the number rounded to specified power of 10.
Returns the number rounded to specified power of 10 .