interface Point { x: number; y: number; z?: number }
createPoint(1, 2) // β { x: 1, y: 2 }
createPoint(1, 2, 3) // β { x: 1, y: 2, z: 3 }A ? suffix marks an interface property as optional β it may be omitted from the object.
A ? suffix marks a property as optional. The object can exist with or without it.
Challenge: Implement createPoint(x, y, z?) returning a Point with optional z.
createPoint(1, 2) // β { x: 1, y: 2 }
createPoint(1, 2, 3) // β { x: 1, y: 2, z: 3 }