Skip to content

Conversation

SczSca
Copy link
Contributor

@SczSca SczSca commented Oct 15, 2022

Describe your change:

  • Add an algorithm: Invert Array.
    Algorithm to invert elements in an array:
    [a,b,c,d] //output [d,c,b,a]

Checklist:

  • [ X] I have read CONTRIBUTING.md.
  • [X ] This pull request is all my own work -- I have not plagiarized.
  • [ X] I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • [X ] All new JavaScript files are placed inside an existing directory.
  • [ X] All filenames should use the UpperCamelCase (PascalCase) style. There should be no spaces in filenames.
    Example:UserProfile.js is allowed but userprofile.js,Userprofile.js,user-Profile.js,userProfile.js are not
  • [ X] All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

Copy link
Collaborator

@appgurueu appgurueu left a comment

Choose a reason for hiding this comment

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

Please...

  1. Name this reverse
  2. Use a proper JSDoc comment
  3. Why is your comment screaming at me?
  4. Don't use a const Array in your tests (shadows the built-in Array) - just inline the arrays
  5. Consider using each here
  6. Declare temp as const inside the loop

@SczSca
Copy link
Contributor Author

SczSca commented Oct 18, 2022

Please...

  1. Name this reverse
  2. Use a proper JSDoc comment
  3. Why is your comment screaming at me?
  4. Don't use a const Array in your tests (shadows the built-in Array) - just inline the arrays
  5. Consider using each here
  6. Declare temp as const inside the loop

Just to be sure:

  1. You mean changing name files to 'Reverse.js' and 'Reverse.test.js' ?
    2/3. Sorry I am still learning to being consistent
  2. For each wouldn't work because it loops over half array

Sorry for these mistakes, I'm a beginner student that heard and is learning about the open-source software

@appgurueu
Copy link
Collaborator

1. You mean changing name files to 'Reverse.js' and 'Reverse.test.js' ?
   2/3. Sorry I am still learning to being consistent

Not only the file names, also the function name.

2. For each wouldn't work because it loops over half array

Sorry, I should've made myself more clear. I did not mean "use for-each for reversing". I meant use Jest's each for testing.

@SczSca SczSca changed the title Invert array Reverse Oct 18, 2022
@SczSca
Copy link
Contributor Author

SczSca commented Oct 19, 2022

1. You mean changing name files to 'Reverse.js' and 'Reverse.test.js' ?
   2/3. Sorry I am still learning to being consistent

Not only the file names, also the function name.

2. For each wouldn't work because it loops over half array

Sorry, I should've made myself more clear. I did not mean "use for-each for reversing". I meant use Jest's each for testing.

Everything is done, I guess.
Sorry for the inconveniences and the amount of commits made. I'm a beginner student that heard a talk about open-source software in Hacktoberfest and wanted to give it a try with some code that was made in one of my classes

Copy link
Collaborator

@appgurueu appgurueu left a comment

Choose a reason for hiding this comment

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

You forgot to rename the files...

@SczSca
Copy link
Contributor Author

SczSca commented Oct 19, 2022

You forgot to rename the files...

the renamed file names are not reflected on the last two commits? I see te files renamed, but I might be wrong

image

image

image

@SczSca SczSca requested a review from syedjafer October 19, 2022 16:24
@raklaptudirm raklaptudirm changed the title Reverse algorithm: reverse Oct 20, 2022
@raklaptudirm raklaptudirm merged commit 636017c into TheAlgorithms:master Oct 20, 2022
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