Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add task solution #2674

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

FrontKid
Copy link

@FrontKid FrontKid commented Aug 3, 2023

No description provided.

Copy link

@Yevheniia-Sid Yevheniia-Sid left a comment

Choose a reason for hiding this comment

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

Great work🚀

Copy link

@Moroz-Dmytro Moroz-Dmytro left a comment

Choose a reason for hiding this comment

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

GJ 👍
Small comments to improve your code

[].__proto__.join2 = function(separator) {
// write code here
[].__proto__.join2 = function(separator = ',') {
const currentArray = this;

Choose a reason for hiding this comment

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

I guess we don't really need to create this variable

Comment on lines 13 to 15
if (!(currentArray instanceof Array)) {
return '';
}

Choose a reason for hiding this comment

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

On line 10 you create this method as a method of Array. So this method can be called only on array

return '';
}

const INDEX_OF_LAST_ELEMENT = currentArray.length - 1;

Choose a reason for hiding this comment

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

If you want to create variable for this, name it in camelCase


let concatedString = '';

for (let curIndex = 0; curIndex < this.length; curIndex++) {
Copy link

Choose a reason for hiding this comment

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

I feel like curIndex is a redundant name, because everyone knows that 'i' is current index ;)

@@ -3,9 +3,28 @@
/**
* Implement method join
*/

const isNotIgnoredEl = (el) => ![null, undefined].includes(el);
Copy link

Choose a reason for hiding this comment

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

let's check if element isIgnored, and then set value to opposite, in place where we call it, I guess that's gonna be more correct

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.

4 participants