ExamGecko
Ask Question

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

Add to Whishlist

List of questions

Question 81

Report Export Collapse

A developer wrote a fizzbuzz function that when passed in a number, returns the following:

β€’ 'Fizz' if the number is divisible by 3.

β€’ 'Buzz' if the number is divisible by 5.

β€’ 'Fizzbuzz' if the number is divisible by both 3 and 5.

β€’ Empty string if the number is divisible by neither 3 or 5.

Which two test cases will properly test scenarios for the fizzbuzz function?

Choose 2 answers

Become a Premium Member for full access
  Unlock Premium Member

Question 82

Report Export Collapse

A developer has code that calculates a restaurant bill, but generates incorrect answers while testing the code:

function calculateBill ( items ) {

let total = 0;

total += findSubTotal(items);

total += addTax(total);

total += addTip(total);

return total;

}

Which option allows the developer to step into each function execution within calculateBill?

Become a Premium Member for full access
  Unlock Premium Member

Question 83

Report Export Collapse

The developer has a function that prints "Hello" to an input name. To test this, thedeveloper created a function that returns "World". However the following snippet does not print " Hello World".

What can the developer do to change the code to print "Hello World" ?

Salesforce Certified JavaScript Developer I image Question 83 63754 09232024002545000000

Become a Premium Member for full access
  Unlock Premium Member

Question 84

Report Export Collapse

A developer has the function, shown below, that is called when a page loads.

function onload() {

console.log("Page has loaded!");

}

Where can the developer see the log statement after loading the page in the browser?

Become a Premium Member for full access
  Unlock Premium Member

Question 85

Report Export Collapse

Refer to the code below:

let sayHello = () => {

console.log ('Hello, world!');

};

Which code executes sayHello once, two minutes from now?

Become a Premium Member for full access
  Unlock Premium Member

Question 86

Report Export Collapse

What is the result of the code block?

Become a Premium Member for full access
  Unlock Premium Member

Question 87

Report Export Collapse

Refer to the following code that imports a module named utils:

import (foo, bar) from '/path/Utils.js';

foo() ;

bar() ;

Which two implementations of Utils.js export foo and bar such that the code above runs without error?

Choose 2 answers

Become a Premium Member for full access
  Unlock Premium Member

Question 88

Report Export Collapse

developer creates a new web server that uses Node.js. It imports a server library that uses events and callbacks for handling server functionality.

The server library is imported with require and is made available to the code by a variable named server. The developer wants to log any issues that the server has while booting up.

Given the code and the information the developer has, which code logs an error at boost with an event?

Become a Premium Member for full access
  Unlock Premium Member

Question 89

Report Export Collapse

Refer to the following code:

function test (val) {

If (val === undefined) {

return 'Undefined values!' ;

}i

f (val === null) {

return 'Null value! ';

}

return val;

}

Let x;

test(x);

What is returned by the function call on line 13?

Become a Premium Member for full access
  Unlock Premium Member

Question 90

Report Export Collapse

Which code statement below correctly persists an objects in local Storage ?

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

Related questions