-
Notifications
You must be signed in to change notification settings - Fork 42
Arrays
Mike edited this page May 28, 2014
·
3 revisions
module.exports.newArray = function(a,b,c,d) {
return [a,b,c,d];
};
module.exports.firstAndLast = function(a) {
var lastIndex = a.length - 1;
return [a[0],a[lastIndex]];
};
TBD
module.exports.addItem = function(item, list) {
if (list.indexOf(item) == -1) {
list.push(item);
}
return list;
};
module.exports.reverseSortedList = function(list) {
return list.sort().reverse();
};