noximus
3/25/2019 - 5:22 PM

different ways of putting dashes

function numberToDashes(num) {
  let array = [];
  for (let i = 0; i < num; i++) {
    const element = array.push("-");
  }
  return array.join('')
}
function numToDashes(num) {
  return "-".repeat(num);
}
console.log('Expect "---" === '+ numToDashes(3))  //Expect "---"
console.log('Expect "-----" === '+numberToDashes(5)) // Expect "-----"