How do I embed JavaScript in Jekyll?

Can you explain what header-includes is? I have not heard that term.

My examples below work for any kind of includes - html, md, js, even .css if you wanted.

If you want an includes file to be used on one page, you use it on the page.

---
---

My content

{% include foo.html %}

If you want it to be used on all pages with say layout post, then you edit that.
_layouts/post.html

---
layout: default 
---

<div class="post-content">
</div>

{% include foo.html %}

If you want on every page, then add it to default.html layout

<head>
    <script src="jquery.js"></script>

    {% include foo.html %}
</head>

<body>
  {{ content }}
</body>

And if your default layout uses a head.html includes such as below, then put it in head.html.

{% include head.html %}

<body>
  {% include header.html %}

  {{ content }}
</body>

Remember that head is for metadata and assets the user can’t see even when they are loaded. body is what they can see - is control how images and text and assets appear for the user.

And in the body you might have a header tag which contains the navbar and site logo. And it might exist as its own header.html includes file.

See minima theme as a reference for layouts and includes