add toJs for while