This is the right & simple way to include any JS file in Drupal 7.

1. Create a folder named i.e. `js`, inside your module folder.
2. Inside that folder place `(modulename).js` file.

 Note: Drupal JS code has a specific format as follows:

        (function ($) {
          $(document).ready(function(){
            alert("Hello world!");	//here we can add our JS code
          });
        })(jQuery);

3. Open `(modulename).info` file & add:

    `scripts[] = js/(modulename).js`

5. Clear Cache & Run.