How do I print a value from Craft/Twig into a Javascript function? I just want to print a value from Craft into a JavaScript function to filter a dashboard.  

The function is this:

showOnly(filterName, values);


I tried this:

showOnly('Short Names','{{ entry.title }}');


But that did not work.  And yes, the filter does work If I hard wire the value that Craft/Twig should print.  But, I need it to match the title of the page as one navigates from entry to entry.

UPDATE

Here is the actual showOnly function in its entirety:

function showOnly(filterName, values) {
    // Think a single select filter.
    sheet = mainViz.getWorkbook().getActiveSheet();
    if(sheet.getSheetType() === 'worksheet') {
        sheet.applyFilterAsync(filterName, values, 'REPLACE');
    } else {
        // for dashboards
        worksheetArray = sheet.getWorksheets();
        for(var i = 0; i &lt; worksheetArray.length; i++) {
            worksheetArray[i].applyFilterAsync(filterName, values, 'REPLACE');
        }
    }
};
That is the correct way of doing it but you need to be sure that entry is a variable and set to an entry model at that point.  And that you're in an appropriate part of your template in general for outputting the code.

E.g. this works for analytics for example, placed at the end of my main structure block.

{# ANALYTICS GOOGLE #}
{% set js %}
&lt;!-- Google Code for Website Conversions Conversion Page --&gt;
&lt;script type="text/javascript"&gt;
/* &lt;![CDATA[ */
var google_conversion_id = XXXXXXXXX;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "XXXXXXXXXX";
var google_conversion_value = {{order.totalPrice}};
var google_conversion_currency = "AUD";
var google_remarketing_only = false;
/* ]]&gt; */
&lt;/script&gt;
&lt;script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js"&gt;
&lt;/script&gt;
&lt;noscript&gt;
&lt;div style="display:inline;"&gt;
&lt;img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/XXXXXXX/?value={{order.totalPrice}}&amp;amp;currency_code=AUD&amp;amp;label=XXXXXXXXX&amp;amp;guid=ON&amp;amp;script=0"/&gt;
&lt;/div&gt;
&lt;/noscript&gt;

{% endset %}

{% includejs js %}