how to force a string to behave as a template literal?

I have a piece of javascript that looks like so:

myfunction(delimiter) {
 let currentLine = `hello world${delimiter}`
 console.log(currentLine)
}

In another section of code, delimiter is set to "\t". That presents a problem, since our output reads hello world\t instead of an actual tab character at the end.

I can’t change delimiter to anything other than "\t" outside the function so I need to somehow / maybe convert it to `\t` within it. (Using `\t` results in currentLine working as expected.)

Essentially, I need to make "\t" work as an actual tab character when building currentLine.

110 thoughts on “how to force a string to behave as a template literal?”

  1. Hey there! This is my 1st comment here so I just wanted to give a quick shout out and say I genuinely enjoy reading through your
    posts. Can you recommend any other blogs/websites/forums that cover
    the same topics? Thanks for your time!

    Reply
  2. Oh my goodness! Impressive article dude!
    Thanks, However I am having problems with your RSS.
    I don’t know the reason why I can’t join it.
    Is there anybody else getting similar RSS issues? Anyone who knows
    the solution will you kindly respond? Thanks!!

    Reply
  3. Hi there, just became aware of your blog through
    Google, and found that it’s truly informative. I am going to watch out for brussels.
    I will be grateful if you continue this in future.

    Many people will be benefited from your writing. Cheers!

    Reply
  4. What’s Happening i am new to this, I stumbled upon this I have discovered It positively useful
    and it has helped me out loads. I am hoping to contribute & aid other customers like its helped me.
    Good job.

    Reply
  5. Have you ever thought about including a little bit more than just your articles?
    I mean, what you say is fundamental and everything. However imagine if you added some great pictures or video clips to give your posts more, “pop”!
    Your content is excellent but with images and videos, this website could undeniably be one of the most beneficial in its field.
    Fantastic blog!

    Reply
  6. Hi, Neat post. There’s an issue together with your website in internet explorer, would test this?

    IE nonetheless is the market leader and a big portion of folks will leave out your
    magnificent writing due to this problem.

    Reply
  7. What i do not understood is actually how you are not really a
    lot more neatly-appreciated than you may be right now.
    You are very intelligent. You understand therefore significantly in terms of this topic, produced me in my opinion imagine it
    from a lot of various angles. Its like men and women don’t seem to be involved unless it’s something to do with Girl gaga!
    Your own stuffs outstanding. Always handle it up! cheap
    flights http://1704milesapart.tumblr.com/ cheap
    flights

    Reply
  8. You really make it appear really easy together with your presentation however I to find this topic to be really something that I feel I would never understand. It seems too complicated and extremely vast for me. I’m taking a look forward in your subsequent submit, I’ll attempt to get the cling of it!

    Reply
  9. Unquestionably believe that which you stated. Your favorite justification seemed to be on the net the easiest thing to be aware
    of. I say to you, I certainly get annoyed while
    people think about worries that they plainly do not know about.
    You managed to hit the nail upon the top and also defined out the whole thing without having side effect , people could take a signal.
    Will likely be back to get more. Thanks scoliosis surgery https://coub.com/stories/962966-scoliosis-surgery scoliosis surgery

    Reply
  10. Hey there would you mind letting me know which hosting company you’re using?
    I’ve loaded your blog in 3 completely different browsers and I must say this blog
    loads a lot faster then most. Can you suggest a good internet
    hosting provider at a fair price? Many thanks, I appreciate it!
    scoliosis surgery https://0401mm.tumblr.com/ scoliosis surgery

    Reply
  11. Wow, awesome weblog structure! How lengthy have you ever been blogging for? you make blogging look easy. The total look of your website is fantastic, as neatly as the content material!

    Reply
  12. Wow, awesome weblog format! How long have you ever been running a blog for? you make blogging glance easy. The overall glance of your site is magnificent, as smartly as the content!

    Reply
  13. I think this is one of the most vital information for me. And i’m glad reading your article. But wanna remark on some general things, The site style is wonderful, the articles is really excellent : D. Good job, cheers

    Reply

Leave a Comment