add convenience function to return a javascript block