I've created a Javascript function which takes a variable number of arguments and prints each out on a new line:
var printOut = function () {
for (var i = 0; i < arguments.length; i++) {
document.writeln(arguments[i] + '<br>');
}
};
printOut('a', 'b', 'c');
printOut('d', 'e');
The function prints out:
a
b
c
d
e
What I'd like to know is whether it's possible to take this function and make it recursive, but the output is in the same order? From what I've studied, recursion would reverse the order of the output no?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.