JS: prepare function support