Leads4pass > Salesforce > Salesforce Certifications > JAVASCRIPT-DEVELOPER-I > JAVASCRIPT-DEVELOPER-I Online Practice Questions and Answers

JAVASCRIPT-DEVELOPER-I Online Practice Questions and Answers

Questions 4

A developer creates a simple webpage with an input field. When a user enters text in the input field and clicks the button, the actual value of the field must bedisplayed in the console.

Here is the HTML file content:

The developer wrote the javascript code below:

Const button = document.querySelector(`button');

button.addEvenListener(`click', () => (

Const input = document.querySelector(`input');

console.log(input.getAttribute(`value'));

When the user clicks the button, the output is always "Hello". What needs to be done to make this code work as expected?

A. Replace line 04 with console.log(input .value);

B. Replace line 03 with const input = document.getElementByName(`input');

C. Replace line 02 with button.addCallback("click", function() {

D. Replace line 02 with button.addEventListener("onclick", function() {

Buy Now
Questions 5

Given the code below:

Function myFunction(){

A =5;

Var b =1;

}

myFunction();

console.log(a);

console.log(b);

What is the expected output?

A. Both lines 08 and 09 are executed, and the variables are outputted.

B. Line 08 outputs the variable, but line 09 throws an error.

C. Line 08 thrones an error, therefore line 09 is never executed.

D. Both lines 08 and 09 are executed, but values outputted are undefined.

Buy Now
Questions 6

Which function should a developer use to repeatedly execute code at a fixed interval ?

A. setIntervel

B. setTimeout

C. setPeriod

D. setInteria

Buy Now
Questions 7

Refer to the code below:

Let str = `javascript';

Str[0] = `J';

Str[4] = 'S';

After changing the stringindex values, the value of str is `javascript'. What is the reason

for this value:

A. Non-primitive values are mutable.

B. Non-primitive values are immutable.

C. Primitive values are mutable.

D. Primitive values are immutable.

Buy Now
Questions 8

A developer creates a class that represents a blog post based on the requirement that a Post should have a body author and view count.

The Code shown Below:

ClassPost {

// Insert code here

This.body =body

This.author = author;

this.viewCount = viewCount;

}

}

Which statement should be inserted in the placeholder on line 02 to allow for a variable to be set to a new instanceof a Post with the three attributes correctly populated?

A. super (body, author, viewCount) {

B. Function Post (body, author, viewCount) {

C. constructor (body, author, viewCount) {

D. constructor() {

Buy Now
Questions 9

Refer to the code below:

Let inArray =[ [ 1, 2 ] , [ 3, 4, 5 ] ];

Which two statements result in the array [1, 2, 3, 4, 5] ?

Choose 2 answers

A. [ ]. Concat.apply ([ ], inArray);

B. []. Concat (... inArray);

C. [ ]. concat.apply(inArray, [ ]);

D. [ ]. concat ( [ ....inArray ] );

Buy Now
Questions 10

Refer to the code below:

Function changeValue(obj) {

Obj.value =obj.value/2;

}

Const objA = (value: 10);

Const objB = objA;

changeValue(objB);

Const result = objA.value;

What is the value of result after the code executes?

A. 10

B. Nan

C. 5

D. Undefined

Buy Now
Questions 11

A developer copied a JavaScript object:

How does the developer access dan's forstName,lastName? Choose 2 answers

A. dan,name

B. dan,firstname ( ) + dan, lastName ( )

C. dan, firstName = dan.lastName

D. dan,name ( )

Buy Now
Questions 12

Refer to the following code that performs a basic mathematical operation on a provided input:

function calculate(num) {

Return (num +10) / 3;

}

How should line 02 be written to ensure that x evaluates to 6 in the line below? Let x = calculate (8);

A. Return Number((num +10) /3 );

B. Return (Number (num +10 ) / 3;

C. Return Integer(num +10) /3;

D. Return Number(num + 10) / 3;

Buy Now
Questions 13

Given the JavaScript below:

Which code should replace the placeholder comment on line 06 to hide accounts that do not match the search string?

A. `None' : `block'

B. `Visible : 'hidden'

C. `Hidden, visible

D. `Block' : `none'

Buy Now
Exam Name: Salesforce Certified JavaScript Developer (JS-Dev-101)
Last Update: Jul 06, 2026
Questions: 223
10%OFF Coupon Code: SAVE10

PDF (Q&A)

$49.99

VCE

$55.99

PDF + VCE

$65.99