I am a new learner, learning to code front end development. I want to know about the global and local variables in JavaScript functions. I understand the local and global, but how about the function parameters, are they local or global?
Should I always define a function as function add(a,b) or
function add(var a, var b)?
Somewhere I read that any variables defined without the var keyword inside a function becomes global. This point is confusing me.
function add(var a, var b){}is not correct syntax, it is alwaysfunction add(a, b){}.varkeyword? This is not an allowed syntax. Function parameters are limited to the function's scope