Skip to content

homework nine#10

Open
ChrissyDev wants to merge 2 commits intomainfrom
homework-nine
Open

homework nine#10
ChrissyDev wants to merge 2 commits intomainfrom
homework-nine

Conversation

@ChrissyDev
Copy link
Owner

No description provided.

Comment on lines 12 to 13
set title(newTitle) {
this._title = newTitle;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add validation rules to each set method

Comment on lines 28 to 35
set releaseYear(newYear) {
if (typeof newYear === 'number') {
this._releaseYear = newYear;
} else {
console.error('Invalid input. Year must be a number.');
}
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use "Return Early" pattern

}

set fileFormat(newFormat) {
this._fileFormat = newFormat;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add validation rules

}

set title(newTitle) {
if (typeof newTitle !== 'string' || newTitle.trim() === '') {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (typeof newTitle !== 'string' || !newTitle.trim().length)
would be more convenient

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments