delete chat javascript logic