Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this._ingredients = ingredients.reduce((acc: string, item: string, index: number) => {
- if (item === null || item === undefined) {
- throw new Error('No ingredients found!');
- }
- if (index !== 0) {
- acc += `, ${item}`;
- } else {
- acc += item;
- }
- return acc;
- }, '');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement