DailyJS
Published in

DailyJS

4 Ways to Combine Strings in JavaScript

Code Tidbit by Samantha Ming.com

Here are four ways to combine strings in JavaScript. My favorite way is using Template Strings. Why? Because it’s more readable, no backslash to escape quotes, no awkward empty space separator, and no more messy plus operators 👏

const icon = '👋';// Template Strings
`hi ${icon}`;
// join() Method
['hi', icon].join(' ');

--

--

--

JavaScript news and opinion.

Recommended from Medium

Don’t Underestimate a Live Rubber Duck

Servassistant on Twitter: “nuviago delicious protein bar chek the linke for more : https://t.co/xOa1

Build a bot with the new Bot Framework Composer — Apiumhub

10-ElasticSearch-Logs: Theming the table and adding loading spinner

Animation With Java Swing

Implementing Cube in React Native

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
Samantha Ming

Samantha Ming

Frontend Developer sharing weekly JS, HTML, CSS code tidbits🔥 Discover them all on samanthaming.com 💛

More from Medium

Top 5 Javascript Frameworks 2022 By Popularity

How to Use a JavaScript Reporting Tool in Your Python Web App

8 JavaScript array method you must know

How to Use the Vuetify Footer Component