A vector object in javascript based off of Daniel Shiffman's The Nature of Code