Skip to content

Instantly share code, notes, and snippets.

@noximus
Last active April 11, 2019 17:20
Show Gist options
  • Save noximus/42065c833b2f9de0b85440eee732c3e9 to your computer and use it in GitHub Desktop.
Save noximus/42065c833b2f9de0b85440eee732c3e9 to your computer and use it in GitHub Desktop.
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 "-----"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment