Created
March 27, 2019 15:46
-
-
Save Shestac92/7846c22876f1d5f329f12b2fcc03710e 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 createProcessor(strings, ...args) { | |
return function (...symbols) { | |
let str = ''; | |
for (let i = 0; i < args.length; i++) { | |
str += `${strings[i]}`; | |
if (symbols[i] || symbols[i] === 0) | |
str += `${symbols[i]}`; | |
} | |
return str; | |
}; | |
} | |
const processor = createProcessor`this${0}is${1}fucking${2}awesome${3}`; | |
console.log(processor(' q ', ' w ', ' e ', ' r ')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment