ENTRY 12 // TABLES, PROPERTIES, AND VARIABLES
Click the button to create a person and display their properties.
JavaScript objects store values under named properties. Luau tables can do the same thing using named keys. In this example, firstname, lastname, age, and eyeColor are the keys.
A local variable exists within its scope. A global variable can be accessed from other code that shares the same environment. Using local variables is usually safer because it reduces accidental name conflicts and makes code easier to maintain.
Declaring an object outside a button's event handler can let multiple handlers use the same object. However, it does not have to be global: a variable declared in the surrounding script can be shared by functions inside that script.