drupal_add_js() function is mainly used to add JavaScript to the page, either as reference to an existing file or as in-line code (by writing the code directly in the page). But it also add settings to Drupal's global storage of JavaScript settings. These settings can access using Drupal.settings variable in JavaScript file.
drupal_add_js
The last release of Drupal was about three years back and Drupal lovers - site builders, developers and administrators - are more than excited to get their hands on the hottest addition to the Drupal Web Development family, Drupal 8. With over 1700 contributors working diligently at building the latest version of Drupal, it comes as no surprise that Drupal 8 has exceeded the expectations of its loyal users and arrived with a bang.