Use Chart.js in Drupal page I am new to Drupal. I created a page and I want to embed charts in that page. I am trying to use chart.js and I have question regarding how to import the script of chart.js in the page i created?

is it like this

&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.4/Chart.min.js"&gt;&lt;/script&gt;


or some other way to do it? I also dont understand how you add javascript code to a drupal page. Thank you.
You need to define it in either a module, or the libraries.yml file of your theme. Then you need to attach it to the page. See the "CDN / externally hosted libraries" of this doc page:

https://www.drupal.org/docs/8/creating-custom-modules/adding-stylesheets-css-and-javascript-js-to-a-drupal-8-module

Then you need to attach the library - this is fairly straightforward in mytheme.theme. 

Example mytheme.theme file:

function mytheme_page_attachments(array &amp;$attachments) {
  $attachments['#attached']['library'][] = 'mytheme/chartjs';
}