ExamGecko
Home Home / Salesforce / Certified JavaScript Developer I

Salesforce Certified JavaScript Developer I Practice Test - Questions Answers, Page 12

Question list
Search
Search

List of questions

Search

Related questions











Refer to code below:

Let first = 'who';

Let second = 'what';

Try{

Try{

Throw new error('Sad trombone');

}catch (err){

First ='Why';

}finally {

Second ='when';

} catch (err) {

Second ='Where';

}

What are the values for first and second once the code executes ?

A.
First is Who and second is When
A.
First is Who and second is When
Answers
B.
First is why and second is where
B.
First is why and second is where
Answers
C.
First is who and second is where
C.
First is who and second is where
Answers
D.
First is why and second is when
D.
First is why and second is when
Answers
Suggested answer: D

Which javascript methods can be used to serialize an object into a string and deserialize a JSON string into an object, respectively?

A.
JSON.stringify and JSON.parse
A.
JSON.stringify and JSON.parse
Answers
B.
JSON.serialize and JSON.deserialize
B.
JSON.serialize and JSON.deserialize
Answers
C.
JSON.encode and JSON.decode
C.
JSON.encode and JSON.decode
Answers
D.
JSON.parse and JSON.deserialize
D.
JSON.parse and JSON.deserialize
Answers
Suggested answer: A

Refer to following code block:

Let array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,];

Let output =0;

For (let num of array){

if (output >0){

Break;

}i

f(num % 2 == 0){

Continue;

}

Output +=num;

What is the value of output after the code executes?

A.
16
A.
16
Answers
B.
36
B.
36
Answers
C.
11
C.
11
Answers
D.
25
D.
25
Answers
Suggested answer: A

Refer to the code below:

<html lang="en">

<table onclick="console.log(Table log');">

<tr id="row1">

<td>Click me!</td>

</tr>

<table>

<script> function printMessage(event) { console.log('Row log');

}

Let elem = document.getElementById('row1'); elem.addEventListener('click', printMessage, false);

</script>

</html>

Which code change should be made for the console to log only Row log when 'Click me! ' is clicked?

A.
Add.event.stopPropagation(); to window.onLoad event handler.
A.
Add.event.stopPropagation(); to window.onLoad event handler.
Answers
B.
Add event.stopPropagation(); to printMessage function.
B.
Add event.stopPropagation(); to printMessage function.
Answers
C.
Add event.removeEventListener(); to window.onLoad event handler.
C.
Add event.removeEventListener(); to window.onLoad event handler.
Answers
D.
Add event.removeEventListener(); toprintMessage function.
D.
Add event.removeEventListener(); toprintMessage function.
Answers
Suggested answer: B

Refer to code below:

Let a ='a';

Let b;

// b = a; console.log(b);

What is displayed when the code executes?

A.
ReferenceError: b is not defined
A.
ReferenceError: b is not defined
Answers
B.
A
B.
A
Answers
C.
Undefined
C.
Undefined
Answers
D.
Null
D.
Null
Answers
Suggested answer: C

Refer to the code below:

let timeFunction =() => {

console.log('Timer called.");

};

let timerId = setTimeout (timedFunction, 1000);

Which statement allows a developer to cancel the scheduled timed function?

A.
removeTimeout(timedFunction);
A.
removeTimeout(timedFunction);
Answers
B.
removeTimeout(timerId);
B.
removeTimeout(timerId);
Answers
C.
clearTimeout(timerId);
C.
clearTimeout(timerId);
Answers
D.
clearTimeout(timedFunction);
D.
clearTimeout(timedFunction);
Answers
Suggested answer: C

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);
A.
[ ]. Concat.apply ([ ], inArray);
Answers
B.
[ ]. Concat (... inArray);
B.
[ ]. Concat (... inArray);
Answers
C.
[ ]. concat.apply(inArray, [ ]);
C.
[ ]. concat.apply(inArray, [ ]);
Answers
D.
[ ]. concat ( [ ….inArray ] );
D.
[ ]. concat ( [ ….inArray ] );
Answers
Suggested answer: A, B

developer has a web server running with Node.js. The command to start the web server is node server,js. The web server started having latency issues. Instead of a one second turn around for web requests, the developer now sees a five second turnaround, Which command can the web developer run to see what the module is doing during the latency period?

A.
DEBUG = http, https node server.js
A.
DEBUG = http, https node server.js
Answers
B.
NODE_DEBUG =http, https node server.js
B.
NODE_DEBUG =http, https node server.js
Answers
C.
DEBUG =true node server.js
C.
DEBUG =true node server.js
Answers
D.
NODE_DEBUG =true node server.js
D.
NODE_DEBUG =true node server.js
Answers
Suggested answer: C

Refer to the code below:

Let foodMenu1 = ['pizza', 'burger', 'French fries'];

Let finalMenu = foodMenu1;

finalMenu.push('Garlic bread');

What is the value of foodMenu1 after the code executes?

A.
[ 'pizza','Burger', 'French fires', 'Garlic bread']
A.
[ 'pizza','Burger', 'French fires', 'Garlic bread']
Answers
B.
[ 'pizza','Burger', 'French fires']
B.
[ 'pizza','Burger', 'French fires']
Answers
C.
[ 'Garlic bread' , 'pizza','Burger', 'French fires' ]
C.
[ 'Garlic bread' , 'pizza','Burger', 'French fires' ]
Answers
D.
[ 'Garlic bread']
D.
[ 'Garlic bread']
Answers
Suggested answer: B

Refer to code below:

Let productSKU = '8675309' ;

A developer has a requirement to generate SKU numbers that are always 19 characters lon, starting with 'sku', and padded with zeros.

Which statement assigns the values sku0000000008675309 ?

A.
productSKU = productSKU .padStart (19. '0').padstart('sku');
A.
productSKU = productSKU .padStart (19. '0').padstart('sku');
Answers
B.
productSKU = productSKU .padEnd (16. '0').padstart('sku');
B.
productSKU = productSKU .padEnd (16. '0').padstart('sku');
Answers
C.
productSKU = productSKU .padEnd (16. '0').padstart(19, 'sku');
C.
productSKU = productSKU .padEnd (16. '0').padstart(19, 'sku');
Answers
D.
productSKU = productSKU .padStart (16. '0').padstart(19, 'sku');
D.
productSKU = productSKU .padStart (16. '0').padstart(19, 'sku');
Answers
Suggested answer: D
Total 224 questions
Go to page: of 23