Last active
April 11, 2019 17:20
-
-
Save noximus/42065c833b2f9de0b85440eee732c3e9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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