You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!-- HTML -->
<p id="my-para"></p>
// JS. Test 1.
document.getElementById('my-para').textContent = 'A few words...';
// JS. Test 2.
document.getElementById('my-para').textContent = "A few words...";
// JS. Test 3.
document.getElementById('my-para').textContent = `A few words...`;
Here are the results :
Using double quotes is always fastest ;
Using backticks is always slowest.
Describe the solution you'd like
A dedicated rule?
Backticks without interpolation needs should be avoid.
The text was updated successfully, but these errors were encountered:
Unfortunately, when I try to reproduce on jsperf (a very good tool, by the way!), the results are a bit random and the backticks aren't always the slowest.
I think it needs a little more work to validate its relevance. Any help is welcome on this topic 👍
Is your feature request related to a problem? Please describe.
In JS, we can write strings inside :
By using backticks, we can inject variables that will be evaluated on runtime, just like that :
I made a simple jsperf test to evaluate the performance between each approach.
Here are the results :
Describe the solution you'd like
A dedicated rule?
Backticks without interpolation needs should be avoid.
The text was updated successfully, but these errors were encountered: