18 lines
352 B
Plaintext
18 lines
352 B
Plaintext
Arrow functions ``++=>++`` use a syntax similar to certain comparison operators (``++<=++``, ``++>=++``). This can create confusion when used in certain contexts.
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
let foo = (x) => x ? "Africa" : "Asia"; // Noncompliant
|
|
----
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
----
|
|
let foo = (x) => { return x ? "Africa" : "Asia"; };
|
|
----
|
|
|
|
|