We’ve all seen functions that look something like this:
function Coord3D(x, y, z) {
// Some operations to edit the parameters, apply default values, etc.
// Return a bunch of values
return {
x: x,
y: y,
z: z
}
}
Since ES2015, you can refactor the above code to something like this, which is a little more readable:
function Coord3D(x, y, z) {
// Some operations to edit the parameters, apply default values, etc.
// Return a bunch of values
return { x, y, z }
}