Is there advantage to using Drupal.settings, as opposed to directly passing json-encoded var to javascript function
The advantage of having in Drupal.settings is the values can be globally accessed across the JavaScript functions. In your case the function "my_js_function" only can access it because of its scope. It is based on the need and if you feel it is unnecessary to have it in settings then you can go with your method.

But best practice is to use Drupal settings. This method will never fail you.