Closed
Description
Can cause major performance issues.
Description
Certain str functions, such as .split() and .find() work on patterns that accept both string literals as well as characters. When using such functions, prefer chars over single-character string literals as they are more performant.
Replace the single-character string literal with a char.
Bad practice
let x = "hello, world";
x.find("o"); // single-character str
Recommended
let x = "hello, world";
x.find('o'); // use a char instead
Metadata
Metadata
Assignees
Labels
No labels