Back-ticks are Not Single Quotes

A Demonstration of the use of grave accent in JavaScript

Image for post
Image for post
Image by author

What We Will Do

In this short article, we are going to demonstrate the difference between back-tick’s `` and single quotes ‘’. Well, at least one of their uses.

More can be found on MDN.

For the Demo

I am going to use Textpad but any text editor that lets you create .html pages and write JavaScript will suffice. Notepad++ it good as well.

Where are Back-ticks Found?

No. Not on your back after a long walk in the woods in the summer.

Image for post
Image for post
` there it is!`

Example:

  1. Create a folder on your hard drive.
  2. Create a file called backtickdemo.html (or whatever you desire) and save it in the folder.
Image for post
Image for post

3. Add the following JavaScript code and HTML elements.

Image for post
Image for post
Note the back-ticks and ${} in addWithBackTicks()

4. Run it in your browser and click each button.

Image for post
Image for post
Same output. Two options

What’s Needed?

If you choose the back-tick method, obviously use back-ticks, NOT single quotes.

You also need to include the variables in ${}.

Conclusion

Is there more to back-ticks. Sure. But I just wanted to get you started and not take much of your time.

Play with it and read more.

Thank you fr your time and happy coding!

JavaScript In Plain English

New JavaScript + Web Development articles every day.

gravity well (Rob Tomlin)

Written by

Self-Employed Software Developer, Trainer, Consultant. Keeping up to date. I’ve noticed in over 28 years of programming, one’s current skills have a shelf life.

JavaScript In Plain English

New JavaScript + Web Development articles every day.

gravity well (Rob Tomlin)

Written by

Self-Employed Software Developer, Trainer, Consultant. Keeping up to date. I’ve noticed in over 28 years of programming, one’s current skills have a shelf life.

JavaScript In Plain English

New JavaScript + Web Development articles every day.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store