Created
June 21, 2019 15:03
-
-
Save bmarcot/bb05627b79f03781d71ada53b7c03f5d 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
const insertAt = (str, sub, pos) => { | |
return str.substring(0, pos) + sub + str.substring(pos); | |
} | |
console.log(insertAt("I want apple", " an", 6)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://jsperf.com/javascript-string-splice