1712 fix javascript function declaration

closes #1712