2023-05-03 11:06:20 +02:00
== Why is this an issue?
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.
2021-04-28 18:08:03 +02:00
2023-05-03 11:06:20 +02:00
=== Noncompliant code example
2020-06-30 12:48:39 +02:00
2022-02-04 17:28:24 +01:00
[source,javascript]
2020-06-30 12:48:39 +02:00
----
function sayHello(name) {
console.log("hello " + name); // Noncompliant
}
----
2021-04-28 18:08:03 +02:00
2023-05-03 11:06:20 +02:00
=== Compliant solution
2020-06-30 12:48:39 +02:00
2022-02-04 17:28:24 +01:00
[source,javascript]
2020-06-30 12:48:39 +02:00
----
function sayHello(name) {
console.log(`hello ${name}`);
}
----
2021-04-28 18:08:03 +02:00
2021-09-20 15:38:42 +02:00
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
2023-05-25 14:18:12 +02:00
=== Message
Convert this concatenation to the use of a template.
=== Highlighting
Entire concatenation expression
2021-09-20 15:38:42 +02:00
endif::env-github,rspecator-view[]