# codesbymanish/javascriptpractice architecture

> Architecture diagram of the GitHub repository codesbymanish/javascriptpractice, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/codesbymanish/javascriptpractice
- Repository: https://github.com/codesbymanish/javascriptpractice

## Overview

##### Project type and purpose
- This is a simple, frontend-only JavaScript practice repository.
- It consists of multiple standalone HTML pages (arrayMethods.html, calculator.html, first.html, randomNumberGen.html) that each load a corresponding script from the js/ folder.
- There is no backend, database, or external service—everything runs in the browser.

##### File structure
- Top-level HTML files: each is a separate demo/page.
- js/ directory: contains one JavaScript module per demo (arrayMethods.js, calculator.js, first.js, ranNumGen.js).
- README.md simply names the project; no additional architecture details or dependencies.
- No build scripts, no frameworks, no deployment config—static files only.

##### Key components
a. Static file host (e.g., GitHub Pages or any HTTP server)
b. Browser client
c. HTML pages (4 separate pages)
d. JavaScript modules loaded by each page
e. The DOM as the runtime environment where the JS manipulates elements

##### Relationships and interactions
- The browser requests an HTML file from the static host
- The HTML file references its JS module in a <script> tag
- The JS module executes in the browser, reads/writes DOM elements in that HTML page
- User interacts via clicks or inputs in the page, triggering functions in the JS module

##### Architectural patterns and design principles
- Simple client-side MVC-ish pattern per page:
- View = HTML markup + CSS (implicit browser rendering)
- Controller = event handlers in the JS module
- Model = in-memory data structures (arrays, numbers) inside each JS file
- Clear separation per demo: each page only loads the code it needs

##### Essential elements
- Clear component names (HTML page names, JS module names)
- Notes on any browser APIs in use (e.g., document.getElementById, event listeners).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User
    User("User"):::user

    %% Browser
    Browser("Browser Client"):::runtime
    click Browser "https://github.com/codesbymanish/javascriptpractice/blob/main/index.htm"

    %% Static File Host
    subgraph "Static File Host (e.g., GitHub Pages)" 
        class Host host
        StaticFilesHost((" ")):::host
        %% HTML Pages
        subgraph "HTML Pages"
            AM_HTML["arrayMethods.html"]:::static
            CALC_HTML["calculator.html"]:::static
            FIRST_HTML["first.html"]:::static
            RNG_HTML["randomNumberGen.html"]:::static
            README["README.md"]:::static
        end
        %% JS Modules
        subgraph "js/"
            AM_JS["arrayMethods.js"]:::static
            CALC_JS["calculator.js"]:::static
            FIRST_JS["first.js"]:::static
            RNG_JS["ranNumGen.js"]:::static
        end
    end
    click StaticFilesHost "https://github.com/codesbymanish/javascriptpractice/tree/main/./"
    click AM_HTML "https://github.com/codesbymanish/javascriptpractice/blob/main/arrayMethods.html"
    click CALC_HTML "https://github.com/codesbymanish/javascriptpractice/blob/main/calculator.html"
    click FIRST_HTML "https://github.com/codesbymanish/javascriptpractice/blob/main/first.html"
    click RNG_HTML "https://github.com/codesbymanish/javascriptpractice/blob/main/randomNumberGen.html"
    click README "https://github.com/codesbymanish/javascriptpractice/blob/main/README.md"
    click AM_JS "https://github.com/codesbymanish/javascriptpractice/blob/main/js/arrayMethods.js"
    click CALC_JS "https://github.com/codesbymanish/javascriptpractice/blob/main/js/calculator.js"
    click FIRST_JS "https://github.com/codesbymanish/javascriptpractice/blob/main/js/first.js"
    click RNG_JS "https://github.com/codesbymanish/javascriptpractice/blob/main/js/ranNumGen.js"

    %% Browser Runtime Components
    subgraph "Browser Runtime" 
        DOM["DOM (document)"]:::runtime
        EventLoop["Event Loop"]:::runtime
    end

    %% Interactions
    User -->|"interacts"| Browser
    Browser -->|"HTTP GET"| AM_HTML
    Browser -->|"HTTP GET"| CALC_HTML
    Browser -->|"HTTP GET"| FIRST_HTML
    Browser -->|"HTTP GET"| RNG_HTML

    AM_HTML -->|"loads script"| AM_JS
    CALC_HTML -->|"loads script"| CALC_JS
    FIRST_HTML -->|"loads script"| FIRST_JS
    RNG_HTML -->|"loads script"| RNG_JS

    AM_JS -->|"reads/writes DOM"| DOM
    CALC_JS -->|"reads/writes DOM"| DOM
    FIRST_JS -->|"reads/writes DOM"| DOM
    RNG_JS -->|"reads/writes DOM"| DOM

    User -->|"click/input"| DOM

    %% Styles
    classDef static fill:#ADD8E6,stroke:#000
    classDef runtime fill:#90EE90,stroke:#000
    classDef host fill:#D3D3D3,stroke:#000
    classDef user fill:#FFD700,stroke:#000
```
