Neither of those examples will work until you fix the call to the Array.sort method
Syntax
array.sort([compareFunction])
Javascript
function a() {
var xyzzy = [40, 1, 5, 200];
xyzzy.sort(); // notice the difference
console.log(xyzzy);
};
a();
On jsfiddle