21 lines
410 B
Plaintext
Raw Normal View History

2020-06-30 12:48:39 +02:00
ECMAScript 2015 added the ability to use template literals instead of concatenation. Since their use is clearer and more concise, they are preferred in environments that support ECMAScript 2015.
2020-06-30 12:48:39 +02:00
== Noncompliant Code Example
----
function sayHello(name) {
console.log("hello " + name); // Noncompliant
}
----
2020-06-30 12:48:39 +02:00
== Compliant Solution
----
function sayHello(name) {
console.log(`hello ${name}`);
}
----