Example use of drupal_add_js to write inline JS in module

If you want to add small JS without creating a new JS file, you can create a module and put the below code in your custom .module file.

drupal_add_js(
  '(function ($) {
// You can write here anything you like to perform. 
 alert("this is test"); })(jQuery);',
  array(
    'type' => 'inline',
    'scope' => 'footer',
    'group' => JS_THEME,
    'weight' => 5,
 )
);