move js declarations to body