dev-seahouse
3/24/2020 - 4:23 PM

[use { } to define multiple variables returned from another function #javascript #snippets

[use { } to define multiple variables returned from another function #javascript #snippets

    const {directionToMove, distanceToMove, squareCollection} = prepareDrawCommandArgs(currentInput);

    ui.userInput = [directionToMove, distanceToMove, squareCollection, cursorLocation];

	// works in arrow function return and the variable name must be the same as the returned one