Update chat.js

added some comments