10 exam-style questions with answers and explanations, straight from our 1,038-question bank. Tap an answer to check yourself. When you're ready, take the scored version in the free practice test.
The TJ exam has 35 questions and runs 1 hours 30 minutes.
These 10 free TJ questions are organized by exam domain, so you can see how each part of the Tosa JavaScript blueprint is tested. Reveal the answer and explanation under each question.
Domain 1: Fundamentals and Applications
Question 1
A browser application reads quantities from form controls, calculates invoice totals, and writes the results into a table. A Node.js batch job must reuse the same calculation rules without loading or emulating a web page.
Which design separates reusable JavaScript from browser-only functionality?
Show answer & explanation
Correct answer: C - Put the calculation in a function that accepts values; keep DOM access in the browser.
Domain 2: Language and Syntax
Question 2
A notification service stores retryDelay as a nonnegative number, null, or undefined. A value of 0 deliberately disables the delay; only null and undefined should become 30.
Complete the assignment so it respects all three cases:
const delay = ______;
Show answer & explanation
Correct answer: B - retryDelay ?? 30
Question 3
An export must skip draft records, stop entirely at the first blocked record, and export every other record encountered before that point. Each record has exactly one status.
for (const record of records) {
if (record.status === "draft") {
// statement 1
}
if (record.status === "blocked") {
// statement 2
}
exportRecord(record);
}
Which pair belongs at statements 1 and 2?
Show answer & explanation
Correct answer: A - continue; then break;
Question 4
A developer expects this returned function to report the phase that existed when the arrow function was created:
function makeReporter() {
let phase = "queued";
const report = () => phase;
phase = "sent";
return report;
}
const report = makeReporter();
The developer now calls report(). Which result and explanation are correct?
Show answer & explanation
Correct answer: D - It returns "sent" because the closure reads the retained phase binding.
Domain 3: Data Structures and Objects
Question 5
An editor creates a draft of a saved profile:
const saved = {
name: "Mira",
preferences: { theme: "light" }
};
const draft = { ...saved };
draft.name = "Noor";
draft.preferences.theme = "dark";
No save operation has run. At this point, what are saved.name and saved.preferences.theme, respectively?
Show answer & explanation
Correct answer: A - "Mira" and "dark"
Question 6
A product selector must return the SKU strings of the two cheapest in-stock products, in ascending price order, without changing catalog or its objects. All prices are distinct finite numbers.
const catalog = [
{ sku: "A", price: 5, inStock: false },
{ sku: "B", price: 30, inStock: true },
{ sku: "C", price: 20, inStock: true },
{ sku: "D", price: 10, inStock: true }
];
Only one expression satisfies both the selection rule and the no-mutation requirement. Identify it.
Show answer & explanation
Correct answer: B - catalog.filter(p => p.inStock).sort((a, b) => a.price - b.price).slice(0, 2).map(p => p.sku)
Domain 4: Packages and APIs
Question 7
A production support console displays a customer-supplied subject using this statement:
subjectElement.innerHTML = subject;
A security review finds that a subject can inject HTML into the console. Subjects must be inserted as text, with no characters removed or interpreted as markup. subjectElement is an existing div, and subject is a string.
Select the replacement that removes this injection point without discarding legitimate text.
Show answer & explanation
Correct answer: D - subjectElement.textContent = subject;
Question 8
A browser fetch call receives HTTP 503 with valid JSON. In this code, showReport displays the JSON error object instead of showFailure running:
fetch("/api/report")
.then(response => response.json())
.then(showReport)
.catch(showFailure);
Neither display function throws. What change sends unsuccessful HTTP responses to showFailure while retaining JSON parsing for successful responses?
Show answer & explanation
Correct answer: C - Check response.ok in the first then callback and throw when it is false before parsing.
Question 9
A log parser recognizes sale and return references:
const match = /(?:sale|return)-([A-Z]{2})-(\d{4})/
.exec("return-GB-4827");
The interface needs the four-digit identifier as a string, without the transaction type or region. Select the expression that produces "4827".
Show answer & explanation
Correct answer: A - match[2]
Domain 5: Applied JavaScript
Question 10
The documentation for an import API states:
readBatch(file) returns a Promise.
On fulfillment: { accepted: [...], rejected: [...] }
Each rejected entry contains a row number and an error message.
Invalid rows do not reject the Promise.
The Promise rejects only if the file cannot be read.
A readable file contains both valid and invalid rows. The import screen must process the valid rows and show the invalid rows' messages. Which handling follows the documented contract?
Show answer & explanation
Correct answer: C - Await the result, process accepted, and display the messages in rejected.
That's 10 of 1,038
The full bank has 1,028 more TJ questions with explanations.