-
-
Notifications
You must be signed in to change notification settings - Fork 360
Implementation Edit to Bubble Sort in Javascript #292
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
Implementation Edit to Bubble Sort in Javascript #292
Conversation
- Added main() - bubbleSort() now returns the sorted array
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.
Well... Same thing as in your bogo sort PR.
@@ -8,4 +8,12 @@ function bubbleSort(arr) { | |||
} | |||
} | |||
} | |||
return arr; |
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.
Same thing as in the bogo sort edit. You don't actually have to return the array.
|
||
function main() { | ||
var testArray = [4,5,123,759,-132,8940,24,34,-5] | ||
print(bubbleSort(testArray)); |
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 print
in JavaScript. Use console.log
and split it up into two lines.
bubbleSort(testArray);
console.log(testArray);
} | ||
|
||
function main() { | ||
var testArray = [4,5,123,759,-132,8940,24,34,-5] |
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.
JS files should be indented with 2 spaces and use const
for non-chaning variables (and let
for mutable ones). var
is pretty much legacy at this point. Also, there should be spaces after the commas in the array initialization ([1, 2, 3]
instead of [1,2,3]
).
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.
Wow. I didn't catch that. GitHub renders the indentation inside main
two spaces wide.
Same with this one, changes seemed to have happened. How's it looking? @Butt4cak3 @Gustorn |
Now it's good. |
Yeah, looks good to me. @Butt4cak3 we need you to approve it |
Changes were made as requested, Butt4cak3 is away
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.
I'm told this os good to go, thank you!
Added main() to code so that it can be run as is