Skip to content

Commit

Permalink
fixed internal type being initially undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
lGrom committed Feb 8, 2024
1 parent be0d627 commit 1f9d5cb
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/Board/Ship.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ export default class Ship {
internalType;

constructor (type) {
// determine if it's a play, graphical, or internal type and use the respective function
if (type <= PLAY_TYPES.SHIP) this.setPlayType(type);
else if (type <= GRAPHICAL_TYPES.LEFT) this.setGraphicalType(type);
else if (type <= INTERNAL_TYPES.HORIZONTAL) this.setInternalType(type);
else throw new Error('type should be a play, graphical, or internal type');
// sets the play and graphical types
this.setInternalType(type);
}

toString () {
Expand Down

0 comments on commit 1f9d5cb

Please sign in to comment.