<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p id="point">fuck</p>
<script>
var by = function(name){
return function(o, p){
var a, b;
if (typeof o === "object" && typeof p === "object" && o && p) {
a = o[name];
b = p[name];
if (a === b) {
return 0;
}
if (typeof a === typeof b) {
return a < b ? -1 : 1;
}
return typeof a < typeof b ? -1 : 1;
}
else {
throw ("error");
}
}
}
var employees=[]
employees[0]={name:"George", age:32, retiredate:"March 12, 2014"}
employees[1]={name:"Edward", age:17, retiredate:"June 2, 2023"}
employees[2]={name:"Christine", age:58, retiredate:"December 20, 2036"}
employees[3]={name:"Sarah", age:62, retiredate:"April 30, 2020"}
employees.sort(by("age"));
var a={};
a.b=employees;
a.c="fuck";
//alert(JSON.stringify(employees.reverse()));
alert(JSON.stringify(a.b.reverse()));
</script>
</body>
</html>
<html>
<head>
</head>
<body>
<p id="point">fuck</p>
<script>
var by = function(name){
return function(o, p){
var a, b;
if (typeof o === "object" && typeof p === "object" && o && p) {
a = o[name];
b = p[name];
if (a === b) {
return 0;
}
if (typeof a === typeof b) {
return a < b ? -1 : 1;
}
return typeof a < typeof b ? -1 : 1;
}
else {
throw ("error");
}
}
}
var employees=[]
employees[0]={name:"George", age:32, retiredate:"March 12, 2014"}
employees[1]={name:"Edward", age:17, retiredate:"June 2, 2023"}
employees[2]={name:"Christine", age:58, retiredate:"December 20, 2036"}
employees[3]={name:"Sarah", age:62, retiredate:"April 30, 2020"}
employees.sort(by("age"));
var a={};
a.b=employees;
a.c="fuck";
//alert(JSON.stringify(employees.reverse()));
alert(JSON.stringify(a.b.reverse()));
</script>
</body>
</html>