MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/oz2q51/how_to_create_a_virtual_keyboard/h7zv6yq/
r/badcode • u/NotAHacker8 • Aug 06 '21
43 comments sorted by
View all comments
Show parent comment
1
Const would work but let would be preferred IMO. (Const is typically for non-changing values, but both are preferred to var to control the scope.)
Either way, with the scope limited to the function, "return element" would need to be added at the end so the function call provides the value.
1 u/_default_username Aug 08 '21 The variable is always referencing the same HTML element, so const is quite appropriate to use.
The variable is always referencing the same HTML element, so const is quite appropriate to use.
View all comments
Show parent comment
1
u/kelub Aug 06 '21
Const would work but let would be preferred IMO. (Const is typically for non-changing values, but both are preferred to var to control the scope.)
Either way, with the scope limited to the function, "return element" would need to be added at the end so the function call provides the value.