The best way to add some javascript to your slim file is either by including the javascript file using
= javascript_include_tag 'name of the file'
or by directly adding the javascript code to your slim file, using
javascript:
code line 1
code line 2
...