Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function take(template, images) {
- images.forEach((image,index) => {
- eval(`image${index} = "${image}"`);
- });
- const newText = eval(`\`${template}\``);
- console.log(newText);
- }
- const template = "${image0} - ${image1} - ${image2}";
- const images = [ 'one.png', 'two.png', 'three.png' ];
- take(template, images); // one.png - two.png - three.png
Add Comment
Please, Sign In to add comment