Skip to content

04 — JavaScript Fundamentals

JavaScript powers much of the modern web.

When you open a browser application, JavaScript may control:

PAGE BEHAVIOR
USER INTERACTIONS
FORM VALIDATION
API REQUESTS
SESSION LOGIC
DYNAMIC CONTENT
CLIENT-SIDE ROUTING
APPLICATION STATE

For cybersecurity professionals, understanding JavaScript is especially valuable in:

WEB APPLICATION SECURITY
APPLICATION SECURITY
PENETRATION TESTING
API SECURITY
BUG BOUNTY
SECURE CODE REVIEW
CLIENT-SIDE SECURITY

The goal of this module is not to turn you into a frontend developer.

The goal is to help you understand:

HOW MODERN WEB APPLICATIONS
BEHAVE INSIDE THE BROWSER

A modern application often follows this model:

USER
BROWSER
JAVASCRIPT
HTTP REQUEST
API
SERVER
DATABASE

If you understand JavaScript, you can better understand:

How Pages Change
How APIs Are Called
How Data Is Processed
How Roles Are Represented
How Client-Side Validation Works
How Browser Storage Is Used
How Application State Changes

Follow this sequence:

JAVASCRIPT BASICS
VARIABLES
DATA TYPES
OPERATORS
CONDITIONS
LOOPS
FUNCTIONS
ARRAYS
OBJECTS
JSON
DOM
EVENTS
FORMS
BROWSER STORAGE
HTTP REQUESTS
FETCH
ASYNC JAVASCRIPT
ERROR HANDLING
WEB SECURITY CONTEXT

JavaScript commonly runs in:

WEB BROWSERS

and can also run outside the browser using environments such as:

Node.js

For this module, the main focus is:

BROWSER JAVASCRIPT

because of its direct relevance to web security.

Modern browsers provide developer tools.

Typical areas include:

Elements
Console
Sources
Network
Application
Storage
Performance

For security learning, some of the most important are:

Console
Network
Sources
Application

Open your browser developer tools and select:

Console

Try:

console.log("JavaScript for Cybersecurity");

Expected output:

JavaScript for Cybersecurity

Create:

script.js

Add:

console.log("Security application loaded");

Link it from HTML:

<script src="script.js"></script>
INPUT
JAVASCRIPT
LOGIC
OUTPUT / PAGE CHANGE / API REQUEST

Single-line comment:

// Security application logic

Multi-line:

/*
Security application
training example
*/

Use comments to explain:

WHY

rather than simply repeating:

WHAT

the code already says.

Modern JavaScript commonly uses:

let
const

Example:

let username = "analyst01";
const applicationName = "NovaPortal";

Use let when the value may change.

let failedLogins = 3;
failedLogins = 4;

Use const when the variable itself should not be reassigned.

const hostname = "WEB01";

Prefer const unless reassignment is required.

Older JavaScript frequently uses:

var username = "analyst01";

You should understand it when reading existing applications, but for modern code prefer:

const
let

because they have clearer scope behavior.

Common JavaScript data types include:

STRING
NUMBER
BOOLEAN
UNDEFINED
NULL
OBJECT
BIGINT
SYMBOL

For cybersecurity-focused learning, concentrate initially on:

STRING
NUMBER
BOOLEAN
ARRAY
OBJECT
NULL
UNDEFINED

Example:

const username = "analyst01";
const sourceIp = "10.10.10.20";

Print:

console.log(username);

Use backticks:

const username = "analyst01";
const ip = "10.10.10.20";
console.log(`User ${username} connected from ${ip}`);

This is often cleaner than string concatenation.

Example:

const failedLogins = 12;
const port = 443;

JavaScript generally uses the number type for integer and floating-point values.

Example:

const mfaEnabled = true;
const isAdmin = false;

Booleans represent:

TRUE
FALSE

null intentionally represents no value.

Example:

let selectedAlert = null;

A variable can be:

let alertSeverity;

Until assigned, its value is:

undefined

Use:

console.log(typeof username);

Example output:

string

Arithmetic:

+
-
*
/
%

Comparison:

===
!==
>
<
>=
<=

Logical:

&&
||
!

Prefer:

===

instead of:

==

Example:

if (severity === "critical") {
console.log("Escalate");
}

Strict equality avoids some automatic type-conversion behavior.

Example:

const failedLogins = 12;
if (failedLogins > 10) {
console.log("Suspicious authentication activity");
}
if (failedLogins > 10) {
console.log("High risk");
} else {
console.log("Normal review");
}
if (failedLogins >= 10) {
console.log("High");
} else if (failedLogins >= 5) {
console.log("Medium");
} else {
console.log("Low");
}
EVENT
CONDITION
TRUE?
├── YES → SECURITY ACTION
└── NO → CONTINUE

Example:

const failedLogins = 12;
const mfaEnabled = false;
if (failedLogins > 10 && !mfaEnabled) {
console.log("High-risk authentication condition");
}
if (
severity === "high" ||
severity === "critical"
) {
console.log("Escalate alert");
}

Arrays store multiple values.

Example:

const suspiciousIps = [
"10.10.10.20",
"10.10.10.30",
"10.10.10.40"
];

Access first element:

console.log(suspiciousIps[0]);

Arrays start at:

0

Example:

Index 0 → First Item
Index 1 → Second Item
Index 2 → Third Item

Use:

suspiciousIps.push("10.10.10.50");

Use:

suspiciousIps.pop();
console.log(suspiciousIps.length);

Example:

for (const ip of suspiciousIps) {
console.log(ip);
}
FOR EACH INDICATOR
PROCESS
DISPLAY / ANALYZE
for (let i = 0; i < suspiciousIps.length; i++) {
console.log(suspiciousIps[i]);
}
suspiciousIps.forEach(function(ip) {
console.log(ip);
});

Arrow-function version:

suspiciousIps.forEach(ip => {
console.log(ip);
});

Objects store related values.

Example:

const alert = {
user: "admin01",
sourceIp: "10.10.10.20",
severity: "high",
failedLogins: 12
};

Dot notation:

console.log(alert.user);

Bracket notation:

console.log(alert["severity"]);

Web applications and APIs heavily use objects.

Example:

USER OBJECT
ALERT OBJECT
SESSION OBJECT
API RESPONSE
APPLICATION STATE

Example:

const alert = {
user: {
name: "admin01",
department: "IT"
},
source: {
ip: "10.10.10.20"
}
};

Access:

console.log(alert.user.name);

Very common in APIs.

Example:

const alerts = [
{
id: 1,
severity: "high"
},
{
id: 2,
severity: "low"
}
];

Example:

const highRiskAlerts = alerts.filter(alert => {
return alert.severity === "high";
});

Shorter:

const highRiskAlerts =
alerts.filter(alert => alert.severity === "high");

map() transforms each item.

const alertIds = alerts.map(alert => alert.id);
const result = alerts.find(alert => {
return alert.id === 2;
});

Traditional function:

function showAlert(message) {
console.log(`ALERT: ${message}`);
}

Call:

showAlert("Suspicious authentication");
function calculateRisk(count) {
if (count >= 10) {
return "high";
}
if (count >= 5) {
return "medium";
}
return "low";
}

Modern JavaScript frequently uses:

const calculateRisk = count => {
if (count >= 10) {
return "high";
}
return "low";
};

Variables have scope.

Example:

function testScope() {
const message = "Inside function";
console.log(message);
}

Outside the function:

message

is not available.

Understanding scope helps when analyzing application logic.

Variables created in broad/global scope may be accessible across large parts of the application.

Excessive global state can create:

MAINTAINABILITY ISSUES
LOGIC CONFUSION
SECURITY ASSUMPTIONS

Sensitive security decisions should not rely on mutable client-side variables.

JavaScript Object Notation is central to modern web applications.

Example:

{
"user": "analyst01",
"role": "user",
"severity": "medium"
}

JavaScript object:

const user = {
name: "analyst01",
role: "user"
};

JSON:

{
"name": "analyst01",
"role": "user"
}

JSON is a text data format.

Use:

const jsonData = `
{
"user": "analyst01",
"severity": "high"
}
`;
const event = JSON.parse(jsonData);
console.log(event.user);
const event = {
user: "analyst01",
severity: "high"
};
const jsonData = JSON.stringify(event);
console.log(jsonData);

Formatted:

console.log(JSON.stringify(event, null, 2));

DOM means:

DOCUMENT OBJECT MODEL

The browser represents HTML as a tree of objects.

Example:

<body>
<h1 id="title">Security Dashboard</h1>
</body>

Conceptually:

DOCUMENT
BODY
H1

Use:

const title = document.getElementById("title");

Then:

console.log(title);

Modern JavaScript often uses:

const title = document.querySelector("#title");

Select by class:

const alertBox =
document.querySelector(".alert");

Use:

const alerts =
document.querySelectorAll(".alert");
const title = document.querySelector("#title");
title.textContent = "Security Operations Dashboard";

Prefer:

element.textContent = userInput;

when plain text is required.

Using APIs that interpret input as HTML requires greater security care.

Remember:

BROWSER
=
USER CONTROLLED ENVIRONMENT

A user can:

Modify JavaScript
Change HTML
Modify Requests
Change Local Storage
Call APIs Directly

Therefore:

CLIENT-SIDE LOGIC
CANNOT BE THE ONLY
SECURITY CONTROL

JavaScript reacts to events.

Examples:

Click
Submit
Change
Load
Keyboard Input

HTML:

<button id="checkButton">
Check Alert
</button>

JavaScript:

const button =
document.querySelector("#checkButton");
button.addEventListener("click", () => {
console.log("Alert review started");
});

HTML forms collect user input.

Example:

<form id="securityForm">
<input id="ipAddress" />
<button type="submit">
Check
</button>
</form>
const form =
document.querySelector("#securityForm");
form.addEventListener("submit", event => {
event.preventDefault();
console.log("Form submitted");
});
const input =
document.querySelector("#ipAddress");
console.log(input.value);

Example:

if (input.value === "") {
console.log("IP address required");
}

This improves user experience.

But:

CLIENT-SIDE VALIDATION
SECURITY ENFORCEMENT

The server must validate inputs independently.

USER INPUT
JAVASCRIPT VALIDATION
HTTP REQUEST
SERVER VALIDATION

Server validation is mandatory.

Browsers provide storage mechanisms such as:

localStorage
sessionStorage
Cookies
IndexedDB

Store:

localStorage.setItem(
"theme",
"dark"
);

Read:

const theme =
localStorage.getItem("theme");

66 — Security Consideration for Browser Storage

Section titled “66 — Security Consideration for Browser Storage”

Avoid storing sensitive secrets in browser storage unnecessarily.

Client-side storage is accessible within the browser security context and may be exposed if the application has client-side vulnerabilities.

Example:

sessionStorage.setItem(
"currentTab",
"alerts"
);

Its lifetime differs from localStorage, but it should still not be treated as a trusted server-side security boundary.

JavaScript may access cookies unless protected with:

HttpOnly

For authentication cookies, important attributes often include:

Secure
HttpOnly
SameSite

If a cookie is marked:

HttpOnly

client-side JavaScript cannot normally read it.

This reduces exposure to certain client-side attacks.

Modern applications frequently use JavaScript to call APIs.

Conceptually:

JAVASCRIPT
HTTP REQUEST
API
JSON RESPONSE

Example against an authorized training API:

fetch("/api/status")
.then(response => response.json())
.then(data => {
console.log(data);
});

The browser may send:

Method
URL
Headers
Cookies
Body

Use the browser Network tab to inspect these requests.

Example:

fetch("/api/alerts", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
message: "Training alert"
})
});

Use only within authorized lab applications.

Network requests do not complete instantly.

JavaScript therefore uses asynchronous programming.

Common concepts:

Callbacks
Promises
async
await

fetch() returns a promise.

Example:

fetch("/api/status")
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error(error));

A cleaner pattern:

async function loadStatus() {
const response =
await fetch("/api/status");
const data =
await response.json();
console.log(data);
}

Call:

loadStatus();

Use:

try {
// code
}
catch (error) {
console.error(error);
}

Example:

async function loadStatus() {
try {
const response =
await fetch("/api/status");
if (!response.ok) {
throw new Error(
`HTTP ${response.status}`
);
}
const data =
await response.json();
console.log(data);
}
catch (error) {
console.error(
"Unable to load status",
error
);
}
}

Important categories:

2xx
Success
3xx
Redirect
4xx
Client / Authorization Error
5xx
Server Error

Common examples:

200 OK
201 Created
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
500 Internal Server Error

A JavaScript application may show:

const user = {
name: "analyst01",
role: "user"
};

This does not mean the server should trust:

user.role

from the browser.

The server must independently determine authorization.

Imagine:

if (user.role === "admin") {
showAdminButton();
}

This controls UI presentation.

It should not be the security boundary.

Secure model:

CLIENT UI
API REQUEST
SERVER CHECKS
AUTHENTICATED ROLE
ALLOW / DENY

This:

adminButton.style.display = "none";

does not protect the underlying administrative endpoint.

A user can interact directly with application requests.

JavaScript frequently handles:

FORM DATA
URL PARAMETERS
API RESPONSES
LOCAL STORAGE
HTML CONTENT

All untrusted data should be handled carefully.

JavaScript can read:

const params =
new URLSearchParams(
window.location.search
);
const id =
params.get("id");

Treat values from the URL as untrusted.

Potentially unsafe data flow:

URL INPUT
JAVASCRIPT
HTML INTERPRETATION
BROWSER

The safe handling strategy depends on whether the data should be treated as:

TEXT
HTML
URL
SCRIPT DATA

When inserting user-controlled text:

element.textContent = value;

is generally safer than interpreting it as markup.

XSS occurs when untrusted input reaches an executable browser context without appropriate handling.

Conceptually:

UNTRUSTED INPUT
APPLICATION
UNSAFE OUTPUT CONTEXT
BROWSER EXECUTION

The correct defense depends on context.

Understand conceptually:

Reflected XSS
Stored XSS
DOM-Based XSS

When reviewing JavaScript, follow:

SOURCE
PROCESSING
SINK

A source might be:

URL
Storage
API Response
User Input

A sink is where data is used.

The security question becomes:

Can Untrusted Data
Reach a Dangerous Context?

Possible client-side data sources include:

location.search
location.hash
localStorage
sessionStorage
postMessage
Form Input
API Responses

Different APIs have different security implications.

Your goal in this course is to recognize when client-controlled data is being:

Displayed as Text
Interpreted as HTML
Used as a URL
Used as Application State

rather than memorizing exploit strings.

Web applications may communicate between frames or windows using:

window.postMessage(...)

Security reviews should verify:

Origin Validation
Expected Message Structure
Trusted Sender
Safe Processing

CORS controls how browsers allow one origin to interact with another.

Conceptually:

ORIGIN A
REQUEST
ORIGIN B
CORS POLICY
BROWSER ALLOWS / BLOCKS

CORS is not a replacement for authentication or authorization.

The browser normally restricts scripts from freely accessing data from unrelated origins.

This is called:

SAME-ORIGIN POLICY

Origins consider:

SCHEME
HOST
PORT

These differ:

https://app.example.com
https://api.example.com

because their hosts differ.

Cookie-authenticated applications should consider whether state-changing requests can be unintentionally initiated from another site.

Defenses may include:

SameSite Cookies
Anti-CSRF Tokens
Origin Validation
Reauthentication

depending on architecture.

JavaScript downloaded by the browser should be considered visible to users.

Therefore do not place true backend secrets in frontend code.

Avoid exposing:

Private API Keys
Database Passwords
Signing Keys
Cloud Secrets

Some values are intentionally public:

API Base URL
Frontend Version
Public Client ID
Feature Flags

Not every value in JavaScript is a secret.

Understand context.

Applications may publish source maps for debugging.

These can reveal more readable source code.

The security question is:

Does This Expose
Sensitive Internal Information?

not merely:

Does a Source Map Exist?

For web security, learn to inspect:

URL
METHOD
STATUS
REQUEST HEADERS
REQUEST BODY
RESPONSE HEADERS
RESPONSE BODY

This helps connect:

FRONTEND ACTION

to:

BACKEND API

When clicking:

View Profile

identify the request generated.

Example conceptual flow:

CLICK PROFILE
JAVASCRIPT
GET /api/profile/1001
JSON
DISPLAY PROFILE

Repeat this for:

Login
Profile
Search
Create
Update
Delete
Approve
Admin Functions

The result becomes an application map.

Suppose the frontend shows:

USER
MANAGER
ADMIN

Document:

Which UI Functions Exist?
Which APIs Are Called?
What Does the Server Allow?

Do not assume frontend visibility equals authorization.

JavaScript often controls workflows.

Example:

if (request.status === "pending") {
showApprovalButton();
}

This is presentation logic.

The server must still validate:

CURRENT STATE
CURRENT USER
CURRENT ROLE
REQUESTED ACTION

When reviewing an application, inspect storage for:

Application Preferences
Session References
User Data
Role Data
Cached API Data

Determine whether sensitive information is stored unnecessarily.

Some browser security controls influence JavaScript behavior.

Examples include:

Content-Security-Policy
Cross-Origin Policies
Cookie Attributes

Understanding JavaScript helps you understand why these controls matter.

CSP can limit:

Allowed Script Sources
Allowed Connections
Allowed Frames
Inline Script Behavior

It can reduce the impact of certain client-side vulnerabilities but should not replace secure coding.

Modern JavaScript applications rely heavily on packages.

Examples:

Frontend Frameworks
Utility Libraries
UI Components
Build Tools

Dependency security therefore matters.

Consider:

Known Vulnerabilities
Abandoned Packages
Unexpected Dependencies
Supply Chain Risk
Dependency Confusion
Integrity

Before adding a package:

Verify Package Name
Check Maintainer
Check Project Activity
Review Dependencies
Confirm Business Need

Node.js allows JavaScript outside the browser.

Check:

Terminal window
node --version

Run:

Terminal window
node script.js

Node.js commonly uses:

npm

Check:

Terminal window
npm --version

Project:

Terminal window
npm init

Understand package-management concepts even if your focus remains browser security.

A JavaScript project may contain:

package.json

which describes:

Project
Scripts
Dependencies
Development Dependencies

Files such as:

package-lock.json

help define exact dependency versions.

They support more reproducible builds.

Use:

console.log()

for basic inspection.

Also learn:

BREAKPOINTS
CALL STACK
VARIABLE INSPECTION
NETWORK INSPECTION

through developer tools.

Expect:

SyntaxError
ReferenceError
TypeError
RangeError

Example:

console.log(userName);

when:

userName

has not been defined.

Example:

const user = null;
console.log(user.name);

This fails because:

null

does not contain:

name

Modern JavaScript allows:

console.log(user?.name);

This can safely return:

undefined

instead of throwing in some cases.

Example:

const role =
user.role ?? "unknown";

This provides a fallback when the value is:

null
undefined

Example:

const alert = {
user: "admin01",
severity: "high"
};
const {
user,
severity
} = alert;

Useful when reading modern application code.

Example:

const baseUser = {
name: "analyst01"
};
const fullUser = {
...baseUser,
role: "user"
};

You will frequently encounter this in modern frontend code.

Modern JavaScript supports modules.

Export:

export function calculateRisk() {
// logic
}

Import:

import {
calculateRisk
} from "./risk.js";

Understanding modules helps when reading larger applications.

When reading JavaScript, ask:

WHERE DOES INPUT COME FROM?
WHERE DOES IT GO?
WHAT TRUST DOES THE CODE PLACE IN IT?
WHAT API IS CALLED?
WHAT SECURITY DECISION
IS MADE CLIENT-SIDE?
DOES THE SERVER RECHECK IT?

125 — Project 01: Security Alert Dashboard

Section titled “125 — Project 01: Security Alert Dashboard”

Create a simple page containing:

Alert ID
Severity
Username
Source IP
Status

Represent alerts using JavaScript objects.

ALERT ARRAY
JAVASCRIPT
FILTER
DOM
DISPLAY

126 — Project 02: High-Risk Alert Filter

Section titled “126 — Project 02: High-Risk Alert Filter”

Given:

const alerts = [
{ id: 1, severity: "high" },
{ id: 2, severity: "low" },
{ id: 3, severity: "critical" }
];

Create:

const importantAlerts =
alerts.filter(alert =>
["high", "critical"].includes(
alert.severity
)
);

Display the results.

127 — Project 03: JSON Security Event Viewer

Section titled “127 — Project 03: JSON Security Event Viewer”

Input:

[
{
"user": "admin01",
"event": "failed_login"
}
]

Process:

JSON
PARSE
ARRAY
DOM
SECURITY EVENT VIEW

128 — Project 04: Authorized API Dashboard

Section titled “128 — Project 04: Authorized API Dashboard”

In an authorized training application:

BROWSER
FETCH
TRAINING API
JSON
DISPLAY RESULTS

Include:

Loading State
Error Handling
Empty Results
Success Results

Create roles:

USER
ANALYST
ADMIN

Use JavaScript to change the visible interface.

Then document the security lesson:

ROLE-BASED UI
IS NOT
SERVER-SIDE AUTHORIZATION

Create a form where user input is displayed using:

textContent

rather than unnecessarily interpreting the value as HTML.

Document why this matters.

131 — Project 07: Browser Storage Review

Section titled “131 — Project 07: Browser Storage Review”

Create a small application using:

localStorage
sessionStorage

Store only non-sensitive preferences.

Document:

WHAT SHOULD NOT
BE STORED HERE?

132 — Project 08: Application Request Mapper

Section titled “132 — Project 08: Application Request Mapper”

Using a training web app, document:

USER ACTION
JAVASCRIPT FUNCTION
HTTP METHOD
ENDPOINT
REQUEST DATA
RESPONSE
DISPLAYED RESULT

133 — JavaScript for Penetration Testers

Section titled “133 — JavaScript for Penetration Testers”

Focus on:

Application Mapping
API Discovery
Frontend Logic
Role Logic
Client-Side Validation
Browser Storage
Request Flows

Focus on:

DOM Security
Input Flows
Safe Rendering
Frontend Authentication
API Interaction
Dependencies
Security Controls

135 — JavaScript for Bug Bounty Learning

Section titled “135 — JavaScript for Bug Bounty Learning”

Focus on authorized targets and understand:

Client-Side Logic
DOM
Endpoints
Objects
Authorization Assumptions
Application State
Business Logic

JavaScript is less central than Python or PowerShell for most SOC workflows, but understanding browser behavior helps investigate:

Phishing
Malicious Websites
Browser-Based Threats
Web Application Events

Use JavaScript when working deeply with:

BROWSER
FRONTEND
WEB APPLICATION LOGIC
CLIENT-SIDE APIs

Use Python when working with:

SECURITY AUTOMATION
LOG PROCESSING
BACKEND APIs
DATA ANALYSIS

JavaScript:

WEB / BROWSER

PowerShell:

WINDOWS / MICROSOFT

Both are useful but solve different cybersecurity problems.

Always consider:

UNTRUSTED INPUT
CLIENT-SIDE TRUST
DOM OUTPUT
STORAGE
API AUTHORIZATION
SECRET EXPOSURE
DEPENDENCIES
ERROR HANDLING

This is one of the most important lessons in web security.

CLIENT
=
USER CONTROLLED

Therefore never make the browser the sole authority for:

ROLE
PERMISSION
PRICE
OWNERSHIP
TENANT
WORKFLOW APPROVAL
SECURITY POLICY

The correct model is:

CLIENT INPUT
SERVER
VALIDATE
AUTHENTICATE
AUTHORIZE
PROCESS

Do not send sensitive data to the browser if the browser does not need it.

Ask:

DOES THE FRONTEND
ACTUALLY NEED THIS FIELD?

Avoid exposing unnecessary:

Stack Traces
Internal Paths
Server Details
Secrets
Debug Objects

to the browser.

Frontend logs should not contain:

Passwords
Access Tokens
Sensitive User Data
Private Keys

Remember browser console logs may be visible to users.

Week Focus
1 Variables, Data Types, Conditions, Functions
2 Arrays, Objects, JSON, DOM
3 Events, Forms, Storage, Fetch, Async
4 Web Security Context and Security Project

You understand:

Variables
Data Types
Conditions
Loops
Functions

You understand:

Arrays
Objects
JSON

You can work with:

DOM
Events
Forms
Browser Storage

You understand:

fetch
HTTP
JSON
Promises
async / await

You can identify:

Client-Side Validation
Client-Side Authorization Assumptions
Browser Storage Risk
DOM Data Flows
Frontend API Calls

Level 06 — Application Security Analysis

Section titled “Level 06 — Application Security Analysis”

You can map:

USER ACTION
JAVASCRIPT
API
SERVER
RESPONSE
APPLICATION STATE
  • JavaScript console used
  • Comments understood
  • let understood
  • const understood
  • Data types understood
  • Strict equality understood
  • Conditions understood
  • Loops understood
  • Function declarations
  • Parameters
  • Return values
  • Arrow functions
  • Scope understood
  • Arrays
  • Objects
  • Nested objects
  • Arrays of objects
  • filter
  • map
  • find
  • JSON structure
  • JSON.parse
  • JSON.stringify
  • Nested JSON understood
  • DOM concept
  • getElementById
  • querySelector
  • querySelectorAll
  • textContent
  • Client-side trust understood
  • Click events
  • Form events
  • preventDefault
  • Input values
  • localStorage
  • sessionStorage
  • Cookies understood
  • Sensitive storage risk understood
  • fetch
  • GET requests
  • POST requests
  • JSON responses
  • HTTP status codes
  • Error handling
  • Promises
  • .then
  • .catch
  • async
  • await
  • try/catch
  • Client-side validation limitation
  • Server-side validation understood
  • Client-side authorization limitation
  • Same-origin policy understood
  • CORS understood
  • Browser storage risks understood
  • XSS concept understood
  • DOM source/sink model understood
  • Frontend secrets avoided
  • Dependency risk understood
  • Alert dashboard
  • High-risk filter
  • JSON event viewer
  • Training API dashboard
  • Role-based UI demo
  • Secure input display
  • Browser storage demo
  • Request mapper

40 JavaScript Fundamentals Review Questions

Section titled “40 JavaScript Fundamentals Review Questions”
  1. Why is JavaScript useful for cybersecurity professionals?
  2. Where does JavaScript commonly execute?
  3. What is the difference between let and const?
  4. Why is var less preferred in modern code?
  5. What is a JavaScript string?
  6. What is a boolean?
  7. What is null?
  8. What is undefined?
  9. What does strict equality === do?
  10. What is an array?
  11. What is an object?
  12. Why are objects important for API data?
  13. What does filter() do?
  14. What does map() do?
  15. What does find() do?
  16. What is a JavaScript function?
  17. What is an arrow function?
  18. What is scope?
  19. What is JSON?
  20. What does JSON.parse() do?
  21. What does JSON.stringify() do?
  22. What is the DOM?
  23. What does querySelector() do?
  24. What does textContent do?
  25. Why is client-side validation not sufficient for security?
  26. What is browser storage?
  27. What is localStorage?
  28. What is sessionStorage?
  29. What is the purpose of an HttpOnly cookie?
  30. What does fetch() do?
  31. What is a promise?
  32. What does async/await provide?
  33. What is the same-origin policy?
  34. What is CORS?
  35. Why should frontend JavaScript not contain backend secrets?
  36. Why should security decisions not rely solely on client-side role variables?
  37. What is DOM-based XSS conceptually?
  38. What is a source-and-sink model?
  39. Why should JavaScript dependencies be reviewed?
  40. How does understanding JavaScript improve web application security testing?

Remember:

USER
BROWSER
HTML
+
JAVASCRIPT
APPLICATION STATE
HTTP REQUEST
API
SERVER
DATABASE

For security analysis:

USER ACTION
JAVASCRIPT
INPUT
CLIENT-SIDE LOGIC
REQUEST
SERVER AUTHORIZATION
RESPONSE
DOM

Do not think:

I NEED TO BECOME
A FRONTEND DEVELOPER

Think:

I NEED TO UNDERSTAND
WHAT THE BROWSER IS DOING

Ask:

WHERE DOES DATA COME FROM?
HOW IS IT PROCESSED?
WHICH API IS CALLED?
WHAT DATA IS SENT?
WHAT DOES THE SERVER RETURN?
WHAT SECURITY DECISIONS
ARE BEING MADE CLIENT-SIDE?
DOES THE SERVER
ENFORCE THEM AGAIN?

The most important web security principle from this module is:

THE BROWSER
IS NOT
A TRUSTED SECURITY BOUNDARY

The browser can improve user experience.

The server must enforce security.

➡️ 05 — SQL for Security Professionals

The next module moves from browser and application logic into structured enterprise data.

You will learn:

DATABASE FUNDAMENTALS
TABLES
ROWS
COLUMNS
SELECT
WHERE
ORDER BY
GROUP BY
COUNT
JOIN
AGGREGATION
SECURITY DATA
LOG ANALYSIS
ACCESS CONTROL
DATABASE SECURITY CONTEXT

The goal will be to use SQL as a practical tool for security investigations, log analysis, vulnerability data analysis, asset inventories, audit reporting, application security understanding, and structured security-data correlation.