javascript: fix for #1580
Merge pull request #1584 from raichoo/master

javascript: fix for #1580