How can I pass a Craft Field into a JavaScript function?
Is the JavaScript inline in your template file? e.g. using {% includeJs %} or even just a &lt;script&gt; tag? If so you should be able to do it as you suggested by outputting Craft variables directly into the JavaScript within your template.

If the function is in an external script, you could call a function from within your template, something along these lines:

{% includeJsFile "/path/to/myfile.js" %}
{% set myJs %}
   myFunction('{{entry.country}}','{{entry.visits}}');
{% endset %}   
{% includeJs myJs %}


And then in your JS file you can have something like

function myfunction(country, visits){
   //do something
}