const
declarations for variables that are never reassigned JS-0242382 let keywords = image.getAttribute("data-keywords").split(",").map(w => `~${w}`);
383 let keyword = keywords[0];
384 let isPrefix = false;
385 for(let key of keywords)386 {
387 if(key.startsWith(currentInput))
388 {
379 inputArea.focus();
380 const image = iconSelectorList.children[iconSelectorCursor];
381 const currentInput = text.split(" ").pop();
382 let keywords = image.getAttribute("data-keywords").split(",").map(w => `~${w}`);383 let keyword = keywords[0];
384 let isPrefix = false;
385 for(let key of keywords)
148 let keywords = e.target.getAttribute("data-keywords").split(",").map(w => `~${w}`);
149 let keyword = keywords[0];
150 let isPrefix = false;
151 for(let key of keywords)152 {
153 if(key.startsWith(currentInput))
154 {
145const iconClickHandler = async (e) => {
146 const currentInput = inputArea.innerText.trimStart().split(" ").pop();
147
148 let keywords = e.target.getAttribute("data-keywords").split(",").map(w => `~${w}`);149 let keyword = keywords[0];
150 let isPrefix = false;
151 for(let key of keywords)
1let fail = false; 2let error = undefined;
3
4let lastUrl = "";
Variables that are never re-assigned a new value after their initial declaration should be declared with the const
keyword.
This prevents the programmer from erroneously re-assigning to a read-only variable, and informs those reading the code that a variable is a constant value.
let pi = Math.PI
for (let x of xs) {
use(x);
}
let { a, b } = object;
use(a, b);
const pi = Math.PI
for (const x of xs) {
use(x);
}
const { a, b } = object;
use(a, b);