Can A Static Website Consist of JavaScript?

Yes! "static pages" means pages that are plain html instead of php or other dynamic page-producing technologies. These are the kind of files that look the same being loaded from the desktop as they do a remote server. Each page is always the same each time it's loaded.

It doesn't have to do with JS, which can appear on static and dynamic pages.


tl;dr if the javascript code manipulates the DOM like a SPA does, it is a client-side dynamic webpage.

As far as the required server infrastructure is concerned, a website with JavaScript can still be considered static because it can be hosted by static hosting services (no server code involved).

But with the extensive use of JavaScript for Client-Side Rendering in Single Page Applications (SPAs) we have to introduce a second dimension of that classification: The way the Document Object Model (DOM) is generated in the browser.

With traditional static webpages the DOM is generated by the browser by parsing an HTML file. Pure static websites which just consist of HTML and maybe some simple JavaScript are therefore static in terms of hosting and DOM generation. In SPAs the DOM is generated by JavaScript creating and manipulating DOM Nodes through the DOM API. Typical SPAs are therefore static in terms of hosting, but dynamic in terms of DOM generation.

Blogpost: The Static Site Awakens and Strikes back


A static site can use javascript. If you use bootstrap for the front-end it will come with js libraries that enhance the UX and look'n'fell for instance. A dynamic site is a site with a server side language (php, python etc.) You could therefore have a dynamic site without javascript ;)