web component - understanding template

by Pasit R

HTML

<template id="myTemplate">
  <h3>this is my template!</h3>
  <script>
    console.log('template script activated');

  </script>
</template>
<h3>this is normal header</h3>
<script>
  console.log('normal script activated');
  var allH3 = document.querySelectorAll('h3');
  console.log('all h3:', allH3.length);

</script>