Skip to content

Comments

done#22

Open
SheikhaAlenezi wants to merge 1 commit intoJoinCODED:mainfrom
SheikhaAlenezi:main
Open

done#22
SheikhaAlenezi wants to merge 1 commit intoJoinCODED:mainfrom
SheikhaAlenezi:main

Conversation

@SheikhaAlenezi
Copy link

No description provided.

@shereengh
Copy link

function addSecondAuthor(book: Book, additionalAuthor: string): Book {
// write your code here...
if (Array.isArray(book.author)) {
return {
...book,
author: [...book.author, additionalAuthor],
};
} else {
return {
...book,
author: [book.author, additionalAuthor],
};
}
}

No need to check if its array if you're applying the same code for both cases

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