Functions and scope
Functions and scope
A function is a reusable block of code. JavaScript functions can be declared with the function keyword. Scope determines the accessibility of variables.
function add(a, b) { return a + b; }
let x = 1; function test() { let y = 2; return x + y; }
Next: Objects and prototypes
Article author: Andrei Olegovich