String(text)
instead.254 */
255 try
256 {
257 currentChatText = text + "";258 makeStatsFromInput(currentChatText);
259 toggleSelector(false);
260 }
String(text)
instead.199 if(!inputArea || !iconSelectorRoot) return;
200 const text = inputArea.innerText.trimStart();
201 const isInputChanged = (currentChatText !== text);
202 currentChatText = text + "";203 if(e.key === "Escape")
204 {
205 try
Prefer using explicit casts by calling Number
, Boolean
, or String
over using operators like +
, !!
or "" +
.
This is considered best practice as it improves readability.
const b = !!foo;
// The `+` operator does not change the value of its operand
// unless it's already a number.
let n = +foo;
n = 1 * foo;
const s = "" + foo;
const b = Boolean(foo);
const n = Number(foo);
const s = String(foo);