Created
March 1, 2024 16:32
-
-
Save isurfer21/9e67abd490ea08eb5169c326aca64f16 to your computer and use it in GitHub Desktop.
Revisions
-
isurfer21 created this gist
Mar 1, 2024 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ function fitIn(template, ...values) { // console.log(template, values); let result = []; for (let i = 0; i < template.length; i++) { result.push(template[i]); if (i < values.length) { result.push(values[i]); } } return result.join(""); } const firstName = "Abhishek", lastName = "Kumar"; const result = fitIn`Hello ${firstName} ${lastName}!`; console.log(result);