ExamGecko
Ask Question

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

Add to Whishlist

List of questions

Question 121

Report Export Collapse

A developer is setting up a new Node.js server with a client library that is built using events and callbacks.

The library:

• Will establish a web socket connection and handle receipt of messages to the server ?

• Will be imported with require, and made available with a variable called we.

The developer also wants to add error logging if a connection fails.

Given this info, which code segment shows the correct way to set up a client with two events that listen at execution time?

Become a Premium Member for full access
  Unlock Premium Member

Question 122

Report Export Collapse

Refer to the code snippet below:

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

For (let i =0; i < array.length; i++)

if (array[i] === 4) {

array.splice(i, 1);

}

}

What is the value of array after the code executes?

Become a Premium Member for full access
  Unlock Premium Member

Question 123

Report Export Collapse

Refer to HTML below:

<p> The current status of an Order: <span id ="status"> In Progress </span> </p>.

Which JavaScript statement changes the text 'In Progress' to 'Completed' ?

Become a Premium Member for full access
  Unlock Premium Member

Question 124

Report Export Collapse

A developer wants to leverage a module to print a price in pretty format, and has imported a method as shown below:

Import printPrice from '/path/PricePrettyPrint.js';

Based on the code, what must be true about the printPrice function of the PricePrettyPrint module for this import to work ?

Become a Premium Member for full access
  Unlock Premium Member

Question 125

Report Export Collapse

What are two unique features of functions defined with a fat arrow as compared to normal function definition?

Choose 2 answers

Become a Premium Member for full access
  Unlock Premium Member

Question 126

Report Export Collapse

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 be displayed in the console.

Here is the HTML file content:

<input type =" text" value="Hello" name ="input">

<button type ="button" >Display </button> 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?

Become a Premium Member for full access
  Unlock Premium Member

Question 127

Report Export Collapse

The developer wants to test this code:

Const toNumber =(strOrNum) => strOrNum;

Which two tests are most accurate for this code?

Choose 2 answers

Become a Premium Member for full access
  Unlock Premium Member

Question 128

Report Export Collapse

A developer implements a function that adds a few values.

Function sum(num) {

If (num == undefined) {

Num =0;

}

Return function( num2, num3){

If (num3 === undefined) {

Num3 =0 ;

}

Return num + num2 + num3;

}}

Which three options can the developer invoke for this function to get a return value of 10 ?

Choose 3 answers

Become a Premium Member for full access
  Unlock Premium Member

Question 129

Report Export Collapse

Refer to the code below:

function changeValue(param) {

Param =5;

} Let a =10;

Let b =5;

changeValue(b);

Const result = a+ " - "+ b;

What is the value of result when code executes?

Become a Premium Member for full access
  Unlock Premium Member

Question 130

Report Export Collapse

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);

Become a Premium Member for full access
  Unlock Premium Member
Total 224 questions
Go to page: of 23
Search

Related questions