Update activity.js

Adding 'while' block