updated prototype and constructor in JS