JavaScript icon indicating copy to clipboard operation
JavaScript copied to clipboard

Reverse

Open SczSca opened this issue 3 years ago • 4 comments

Describe your change:

  • [X] 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}.

SczSca avatar Oct 15 '22 20:10 SczSca

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

SczSca avatar Oct 18 '22 03:10 SczSca

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.

appgurueu avatar Oct 18 '22 06:10 appgurueu

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

SczSca avatar Oct 19 '22 02:10 SczSca

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 avatar Oct 19 '22 15:10 SczSca