Preview:ts const flags = ["A", "B", "a", "b"] const weights = { a: 1, b: 2, c: 1, d: 1, } const value = flags.reduce( (a, b) => a + (b in weights ? weights[b] : 0), 0 )
You can choose specific lines to embed by selecting them before copying the link.