Hmm, I'd say that mostly the use of var in new code is bad code. It does greatly annoy me when people trying to show others how to do things in articles in 2024 use var indiscriminately. There is no call for that. What's worse is that this then gets picked up in LLM's and so you end up with perpetuated bad code.
Thanks, that pretty much sums it up with the caveats I failed to add. I'm reading discussions and tutorials all the time to learn new things, and I constantly see this. And yes, even chatgpt gives answers using var. When I asked why, it apologized and rewrote the answer
Yes, I noticed that. It has memory now though so you should be able to tell it to prefer const/let over var. I also told it to stop using semi-colons and use single quotes for strings.
now waiting for it to escape single quotes
please tell me you told her.... wait did I just use her?
to use back ticks in certain cases?
Side Note:
Just a preference of mine: when a string contains single quotes - right or wrong, I prefer back ticks in various scenarios (not just to easily concatenate variables)
I do use singles all the time (in case I get scored)
It (yes, it is an it ) uses backticks quite freely. Remember, it uses what other people have already created to flavour its own responses. So it happily uses backticks for multi-line strings for example.
I believe best practices would require that to become let someThingBe;
I can understand that to cleanup the codebase of Node-RED would be a wonderful thing, especially since let is the new kid on the block but it could potentially be a case of polishing broken windows - the codebase does have refactoring potential, so any attempt to remove all the vars should not be done via a "ten minute chat with ChatGPT" but rather with a concentrated effort to refactor stuff.
Heck, it's nearly weekend, might be a good exercise to also get a better understand of the NR codebase and how it all works. (Spoiler: damn impressive work.)
But that won't happen since no one enjoys maintaining old code written by others.