In Drupal 7,
drupal_add_library() could be used to add JS and CSS to a page. In Drupal 8, these functions have been removed. Instead, you must use
#attached in a render array.
#attached was already available in Drupal 7, and was widely used, but now it'll be the only way to attach assets.