Closed joequery closed 12 years ago
I think this is good too, though it you really want to make it super generic I would suggest making switch_page
take any number of arguments and then passing the list into reset. That way we don't have to count on reset only ever accepting slug
or nothing. (Otherwise we'll end up de-DRYing this later on with a bunch of if/else blocks.
This key to accomplishing this is the arguments
variable which always contains the list passed to the function and the apply
method which allows you call a function with a list of arguments, documented here:
https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/apply
Up for making the changes?
Yeah, I try to get to this tonight or tomorrow.
The goto functions were looking a bit repetitive, I attempted to DRY them up a bit. Feel free to disregard if you don't agree with it.