Note the twig_js
tag above is a compile-time directive which allows you to set the name of the compiled Javascript function. You can omit it, in which case the compiler will make a best effort to determine a good name, but might fail.
The above Twig file, will then be compiled to Javascript which will look similar to this:
You can then include this file along with the twig.js runtime environment on your website: