Created
March 11, 2018 02:07
-
-
Save dance2die/30d8fa3f3c240c8cbafcf2c16ad2d161 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function reverseDemo(orders) { | |
const mid = orders.length / 2; | |
const leftHalf = orders.slice(0, mid); | |
const rightHalf = orders.slice(mid); | |
const combinedOrders = rightHalf.concat(leftHalf); | |
const indentBy = 4; | |
printHeaderFooter( | |
"Reversing from this list", | |
() => printOrders(combinedOrders, indentBy), | |
indentBy, | |
"*" | |
); | |
const reversedOrders = combinedOrders.reverse(); | |
printOrders(reversedOrders); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment