CIW JavaScript Specialist Exam Prep
Free practice questions

Free JavaScript Specialist Practice Questions

10 exam-style questions with answers and explanations, straight from our 1,044-question bank. Tap an answer to check yourself. When you're ready, take the scored version in the free practice test.

Start the free practice test → ★★★★★4.9/5 from 2,400+ candidates · No signup

The JavaScript Specialist exam has 55 questions and runs 1 hours 30 minutes.

These 10 free JavaScript Specialist questions are organized by exam domain, so you can see how each part of the CIW JavaScript Specialist blueprint is tested. Reveal the answer and explanation under each question.

Domain 1: Essential JavaScript Principles and Practices

Question 1

An order form uses price to reference a text input, and price.value is the string "18.75". A delivery charge of 4 must be added. The input has already been validated, and the total must remain a number for later calculations. Which expression produces the required total?

Show answer & explanation

Correct answer: C - Number(price.value) + 4

Question 2

A translation helper is created before the application's language setting changes: let language = 'en'; function makeLabel(language) { return key => `${language}:${key}`; } const label = makeLabel(language); language = 'fr'; Without recreating label, a test calls label('save'). What should the assertion expect?

Show answer & explanation

Correct answer: D - "en:save", because the closure retains makeLabel's separate parameter binding.

Question 3

After a component closes, its click handler still runs. Registration and cleanup use the same existing button and component objects: const component = { count: 0, record() { this.count++; } }; button.addEventListener('click', component.record.bind(component)); button.removeEventListener('click', component.record.bind(component)); The button has no other listeners. What makes this cleanup ineffective?

Show answer & explanation

Correct answer: B - Each bind call produces a new function, so the callback references do not match.

Domain 2: Intermediate JavaScript Programming Techniques

Question 4

A user-interface component temporarily overrides one instance's label method: class Badge { label() { return 'Member'; } } const badge = new Badge(); badge.label = function () { return 'Editor'; }; delete badge.label; const text = badge.label(); After the override is removed, what happens at the final assignment?

Show answer & explanation

Correct answer: D - text becomes "Member"; lookup reaches the prototype after deletion.

Question 5

A publishing tool checks page approvals with this function: function canPublish(pages) { pages.forEach(page => { if (!page.approved) return false; }); return true; } const result = canPublish([ { approved: true }, { approved: false }, { approved: true } ]); What does the approval check actually do with these three pages?

Show answer & explanation

Correct answer: C - Returns true after visiting all three pages in the array.

Question 6

A product-code validator must accept exactly two uppercase ASCII letters followed by four digits. It passes once for AB2048, fails for the same string on the next call, then passes again. No code alters the input. const codePattern = /^[A-Z]{2}[0-9]{4}$/g; function isCode(value) { return codePattern.test(value); } Which edit removes the alternating result without weakening the format rule?

Show answer & explanation

Correct answer: B - Remove g while retaining the anchors and character classes.

Domain 3: Applied JavaScript

Question 7

A support dashboard displays customer-supplied ticket subjects inside a div. A subject containing an image tag with an event handler has executed script in a support agent's session. Subjects must appear literally, including angle brackets; embedded markup is not a supported feature. Which replacement for subjectElement.innerHTML = subject directly fixes this rendering defect?

Show answer & explanation

Correct answer: B - subjectElement.textContent = subject;

Question 8

An editor wants to clear the needs-review class from every marked paragraph. The page has exactly these three matching elements, in this order, when the code runs: <p id="intro" class="needs-review">Introduction</p> <p id="details" class="needs-review">Details</p> <p id="summary" class="needs-review">Summary</p> const pending = document.getElementsByClassName('needs-review'); for (let i = 0; i < pending.length; i++) { pending[i].classList.remove('needs-review'); } Which paragraph remains marked when the loop finishes?

Show answer & explanation

Correct answer: C - The details paragraph.

Domain 4: Advanced JavaScript Development

Question 9

A profile editor sends the request below. The same-origin server responds with HTTP 409 and the valid JSON body {"error":"Name already used"}. The response is readable, and showMessage returns normally. fetch('/api/profile', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ displayName: 'Robin' }) }) .then(response => response.json()) .then(() => showMessage('Saved')) .catch(() => showMessage('Save failed')); Why can 'Saved' appear after this response?

Show answer & explanation

Correct answer: A - Fetch fulfills on HTTP 409; parsing its valid JSON also fulfills.

Question 10

library.js defines window.makeChart. dashboard.js calls makeChart and reads an element declared later in the body. Both files are external classic scripts placed in the head. Parsing must continue while they download, and dashboard.js must execute after both its dependency and the required HTML are ready. Choose the appropriate pair of script tags, in source order.

Show answer & explanation

Correct answer: A - <script defer src="library.js"></script> <script defer src="dashboard.js"></script>

That's 10 of 1,044

The full bank has 1,034 more JavaScript Specialist questions with explanations.

Continue in the free practice test →

View plans