Message from JavaScript discussions

April 2019

— Isn't it?


You can do simple functions like
function getValue(id) {
return document.getElementById(id).value

— To simplify things

— No, it doesn’t, but you’re not declaring those variables in the last two functions

— Yesss!!! Didn't get this one

— Thanks

— Is it wrong?

— Yes, because it’s polluting your global namespace.

— Let has a code block namespace

— Avoid side effects when possible

— So what should I use instead of?

— Var