What I did to solve this issue was to create add the following Placeholder in my main layout page (for me, at the end of the Javascript script tags)...
@Html.Sitecore().Placeholder("javascript")
Next add a Sitecore View Rendering that contains the Javascript...
@using Sitecore.Mvc
@using Sitecore.Mvc.Presentation
@model RenderingModel
<script>
    $(function () {
        // your javascript
    });
</script>
This rendering then gets added to the Design Layout of the content item assigning it to the placeholder "javascript".
As a beginner with Sitecore, I'd be interested what others thought of this solution.