some javascript for list operations