-
Notifications
You must be signed in to change notification settings - Fork 5
Final #2
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
base: main
Are you sure you want to change the base?
Final #2
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,65 @@ | ||
| class ArrayUtils{ | ||
| class ArrayUtils { | ||
|
|
||
| isEmpty(array){return false;} | ||
| constructor(original, array, value) { | ||
| this.original = original; | ||
| this.array = array; | ||
| this.value = value; | ||
| } | ||
|
|
||
| append(original, value){return original;} | ||
| isEmpty(array) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| if (array[""]) { | ||
| return false; | ||
| } else { | ||
| return true; | ||
| } | ||
| } | ||
|
|
||
| clone(original){return original;} | ||
| append(original, value) { | ||
| return original.push(value); | ||
| } | ||
|
|
||
| subArray(original, from, to){return original;} | ||
| getClone(original) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Solution works, make sure you don't change the function name though |
||
| clone = [...original]; | ||
| return clone; | ||
| } | ||
|
|
||
| equals(arr1, arr2){return false;} | ||
| getSubArray(original, y, z) { | ||
| let subArray = original.slice(y, z + 1); | ||
| return subArray; | ||
| } | ||
|
|
||
| fill(original, value){} | ||
| arraysEqual(arr1, arr2) { | ||
| if (arr1 === arr2) | ||
| return true; | ||
| else if (arr1 == null || arr2 == null) | ||
| return false; | ||
| else(arr1.length !== arr2.length) | ||
| return false; | ||
| } | ||
|
|
||
| indexOf(original, value){return -1;} | ||
| fillArray(original, value) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| return original.fill(value); | ||
| } | ||
|
|
||
| remove(original, value){return original;} | ||
| indexOf(original, value) { | ||
| return original.indexOf(value); | ||
| } | ||
|
|
||
| reverse(original){} | ||
|
|
||
| remove(original, value) { | ||
| let copy = original; | ||
| for (let i = 0; i < copy.length; i++) { | ||
| if (copy[i] === value) { | ||
| newCopy += copy.splice(i, 1); | ||
| } | ||
| } | ||
| return newCopy; | ||
| } | ||
|
|
||
| reverseArray([original]) { | ||
| let newArray = []; | ||
| for (let i = original.length - 1; i >= 0; i--) { | ||
| newArray += original.charAt([i]); | ||
| } | ||
| return newArray; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <!DOCTYPE html> | ||
| <html> | ||
|
|
||
| <head> | ||
| <title>Whaddup</title> | ||
| </head> | ||
|
|
||
| <body id="color"> | ||
|
|
||
| <div id="remove"></div> | ||
|
|
||
|
|
||
| <script src="ArrayUtils.js"></script> | ||
|
|
||
| </body> | ||
|
|
||
| </html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for a constructor