function isSafe(queensPositions, rowIndex, columnIndex) {
  // New position to which the Queen is going to be placed.
  const newQueenPosition = new QueenPosition(rowIndex, columnIndex);

  // Check if new queen position conflicts with any other queens.
  for (let queenIndex = 0; queenIndex < queensPositions.length; queenIndex += 1) {
    const currentQueenPosition = queensPositions[queenIndex];

    if (
      // Check if queen has been already placed.
      currentQueenPosition
      && (
        // Check if there are any queen on the same column.
        newQueenPosition.columnIndex === currentQueenPosition.columnIndex
        // Check if there are any queen on the same row.
        || newQueenPosition.rowIndex === currentQueenPosition.rowIndex
        // Check if there are any queen on the same left diagonal.
        || newQueenPosition.leftDiagonal === currentQueenPosition.leftDiagonal
        // Check if there are any queen on the same right diagonal.
        || newQueenPosition.rightDiagonal === currentQueenPosition.rightDiagonal
      )
    ) {
      // Can't place queen into current position since there are other queens that
      // are threatening it.
      return false;
    }
  }

  // Looks like we're safe.
  return true;
}
@param {QueenPosition[]} queensPositions
@param {number} rowIndex
@param {number} columnIndex
@return {boolean}