- We have the following function that draws a point:
function drawPoint(x: number, y: number, z: number) {
...
}
We also have the following point variable:
const point: [number, number, number] = [100, 200, 300];
How can we call the drawPoint function in a terse manner?
drawPoint(...point);
- We need to create another version of the drawPoint function that can call by passing the x, y, and z point values as parameters:
drawPoint(1, 2, 3);
Internally in the implementation of drawPoint we draw the point from a tuple data type, [number, number, number]. How can we define the method parameter(s) with the required tuple?
function drawPoint(...point: [number, number, number]) {
...
}
- In your implementation of drawPoint, how can you make the z point optional?
function drawPoint(...point: [number, number, number?]) {
...
}
- We have a function called...