[js] fix invalid pointer assignment