Javascript
[
function (){console.log('Line1')},
function (){console.log('Line2')},
function (){console.log('Line3')},
function (){console.log('Line4')}
].reverse().forEach(function(e){e();})
[
function (){console.log('Line1')},
function (){console.log('Line2')},
function (){console.log('Line3')},
function (){console.log('Line4')}
].reverse().forEach(function(e){e();})
C++11
#include <iostream>
#include <vector>
#include <algorithm>
int main() {
std::vector<std::function<void()>> functors;
functors.push_back([] { std::cout << "Line1"; });
functors.push_back([] { std::cout << "Line2"; });
functors.push_back([] { std::cout << "Line3"; });
functors.push_back([] { std::cout << "Line4"; });
std::reverse(functors.begin(),functors.end());
std::for_each (functors.begin(), functors.end(), [](std::function<void()> f) {f();});
return 0;
}