Let's discuss scope for a while before we build a larger application. Simply put, scope defines when and where we can use a variable or a function. Scope in JavaScript is broken down into two discrete categories: local and global. If we look at our previous multiplication program, we can see that there are three variables outside any functions; they're hanging out at the root level of our program:
01: const a = [1, 3, 5, 7, 9]
02: const b = [2, 5, 7, 9, 14]
03:
04: // compute the products of each permutation for efficient retrieval
05:
06: const products = { }
07:
08: const makeProducts = function(array1, array2) {
09: array1.forEach( (multiplicant) => {
10: if (!products[multiplicant]) {
11: products[multiplicant] = { }
12: }
13: array2.forEach( (multiplier) => {
14: if (!products[multiplier]) {
15: products[multiplier] = { }
16: }
17: products[multiplicant][multiplier]...