From the course: JavaScript: Best Practices for Data

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Standardize quotes

Standardize quotes - JavaScript Tutorial

From the course: JavaScript: Best Practices for Data

Start my 1-month free trial

Standardize quotes

- [Instructor] JavaScript offers a few different options for enclosing items in quotes. As long as your quote characters are paired, you can use single quotes, double quotes, or even backticks if you're working with Modern JS. For the sake of efficiency and consistency, a lot of developers choose to standardize on just one quote style. Before JavaScript, I worked with HTML, which required double quotes. So I initially wrote my JavaScript with double quotes. But over time I noticed that single quotes had the advantage of not requiring me to hit the Shift key to type them. So I made the switch. And in general, single quotes are pretty popular in JavaScript. Whichever style you choose to standardize on, you can commit to it using ESLint quotes rule. It takes an array in which you specify the alert level and which quote style you use. In my code, my use strict statement uses double quotes. I have a couple of rays that use…

Contents