Although you can create a workable outline document without JavaScript, JavaScript can improve upon the solution, if you put in a little work.
With JavaScript, you can keep the outline visible while the user reads the document, and you can make the outline much easier to navigate.