Open this example in the interactive library
Source code
const words = ["build", "ship", "test"];
console.log((<A, B>(left: A, right: B): [B, A] => [right, left])("rank", 2));
Sample output
[ 2, 'rank' ]

Open this example in the interactive library
const words = ["build", "ship", "test"];
console.log((<A, B>(left: A, right: B): [B, A] => [right, left])("rank", 2));
[ 2, 'rank' ]