2018-03-24 16:22:20 +05:30

8 lines
184 B
JavaScript

// Array destructing
const result = [0] |> ([x]) => x;
expect(result).toBe(0);
// Object destructuring
const result2 = { y: 1, z: 2 } |> ({ y, z }) => y + z;
expect(result2).toBe(3);