Working out how to do objects in javascript