Python Remove Last Element From Array To Hashmap Javascript