Making Arrays Or Objects
Creating Arrays
// Simple array
numbers = [1, 2, 3, 4, 5]
// Array with expressions
base = 10
computed = [base * 1, base * 2, base * 3] // [10, 20, 30]
// Mixed type array
mixed = [1, "text", true, {x: 10}]
// Array with computed values
vals = [1 + 1, "pre" ++ "fix", 10 * 2] // [2, "prefix", 20]
// Note: ++ concatenates without spaces, so "pre" ++ "fix" becomes "prefix"Creating Objects
Important Notes
Last updated