Free CRT-600 Exam Braindumps (page: 5)

Page 4 of 57

A developer is creating a simple webpage with a button.
When a user clicks this button for the first time, a message is displayed.
The developer wrote the JavaScript code below, but something is missing. The message gets displayed every time a user clicks the button, instead of just the first time.
01 function listen(event) {
02 alert ( `Hey! I am John Doe') ;
03 button.addEventListener (`click', listen);

Which two code lines make this code work as required?
Choose 2 answers

  1. On line 02, use event.first to test if it is the first execution.
  2. On line 04, use event.stopPropagation ( ),
  3. On line 04, use button.removeEventListener(` click" , listen);
  4. On line 06, add an option called once to button.addEventListener().

Answer(s): C,D



A developer uses a parsed JSON string to work with user information as in the block below:
01 const userInformation ={
02 " id " : "user-01",
03 "email" : "user01@universalcontainers.demo",
04 "age" : 25

Which two options access the email attribute in the object? Choose 2 answers

  1. userInformation("email")
  2. userInformation.get("email")
  3. userInformation.email
  4. userInformation(email)

Answer(s): A,C



Refer to the code below:
01 const server = require(`server');
02 /* Insert code here */
A developer imports a library that creates a web server. The imported library uses events and callbacks to start the servers
Which code should be inserted at the line 03 to set up an event and start the web server ?

  1. Server.start ();
  2. server.on(` connect ' , ( port) => {
    console.log(`Listening on ' , port) ;})
  3. server()
  4. serve(( port) => (
  5. console.log( `Listening on ', port) ;

Answer(s): B



A developer wants to iterate through an array of objects and count the objects and count the objects whose property value, name, starts with the letter N. Const arrObj = [{"name" : "Zach"} , {"name" : "Kate"},{"name" : "Alise"},{"name" : "Bob"},{"name" :
"Natham"},{"name" : "nathaniel"}
Refer to the code snippet below:
01 arrObj.reduce(( acc, curr) => {
02 //missing line 02
02 //missing line 03
04 ). 0);
Which missing lines 02 and 03 return the correct count?

  1. Const sum = curr.startsWith(`N') ? 1: 0;
    Return acc +sum
  2. Const sum = curr.name.startsWith(`N') ? 1: 0;
    Return acc +sum
  3. Const sum = curr.startsWIth(`N') ? 1: 0;
    Return curr+ sum
  4. Const sum = curr.name.startsWIth(`N') ? 1: 0;
    Return curr+ sum

Answer(s): B






Post your Comments and Discuss Salesforce CRT-600 exam with other Community members:

CRT-600 Discussions & Posts