Expansions within a JS function