[Dec 30, 2024] Lesson Brilliant PDF for the JavaScript-Developer-I Tests Free Updated Today [Q56-Q72]

Share

[Dec 30, 2024] Lesson Brilliant PDF for the JavaScript-Developer-I Tests Free Updated Today

Get New 2024 Valid Practice Salesforce Developer JavaScript-Developer-I Q&A - Testing Engine

NEW QUESTION # 56
A developer creates a generic function to log custom messages in the console. To do this, the function below is implemented.
01 function logStatus(status){
02 console./*Answer goes here*/{'Item status is: %s', status};
03 }
Which three console logging methods allow the use of string substitution in line 02?

  • A. Message
  • B. Error
  • C. Log
  • D. Assert
  • E. Info

Answer: C,D,E


NEW QUESTION # 57
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?

  • A. Using the debugger command on line 03
  • B. Using the debugger command on line 05.
  • C. Calling the console.trace (total) method on line 03.
  • D. Wrapping findSubtotal in a console.log() method.

Answer: B


NEW QUESTION # 58
A developer is trying to handle an error within a function.
Which code segment shows the correct approach to handle an error without propagating it elsewhere?

  • A.
  • B.
  • C.
  • D.

Answer: C


NEW QUESTION # 59
Refer to the code below:

What is the value of result when Promise. race executes?

  • A. Car 2 completed the race
  • B. Car 3 completed the race
  • C. Car 1 crashed the race
  • D. Race is cancelled.

Answer: C


NEW QUESTION # 60
Which statement parses successfully?

  • A. JSON. parse (""foo"');
  • B. JSON.parse (""foo'");
  • C. JSON.parse ("foo");
  • D. JSON.parse ("foo");

Answer: A


NEW QUESTION # 61
A developer creates a generic function to log custom messages In the console. To do this, the function below is implemented.

Which three console logging methods allow the use of string substitution in line 02?
Choose 3 answers

  • A. error
  • B. Log
  • C. Message
  • D. Assert
  • E. Info

Answer: A,C,D


NEW QUESTION # 62
Consider type coercion, what does the following expression evaluate to?
True + 3 + '100' + null

  • A. 0
  • B. '4100null'
  • C. 1
  • D. '3100null'

Answer: B


NEW QUESTION # 63
Refer to the code below:
new Promise((resolve, reject) => {
const fraction = Math.random();
if( fraction >0.5) reject("fraction > 0.5, " + fraction);
resolve(fraction);
})
.then(() =>console.log("resolved"))
.catch((error) => console.error(error))
.finally(() => console.log(" when am I called?"));

When does Promise.finally on line 08 get called?

  • A. When resolved or rejected
  • B. When rejected
  • C. WHen resolved
  • D. When resolved and settled

Answer: A


NEW QUESTION # 64
Refer to the code below:

Line 05 causes an error.
What are the values of greeting and salutation once code completes?

  • A. Greeting is Goodbye and salutation is Hello, Hello.
  • B. Greeting is Hello and salutation is I say hello.
  • C. Greeting is Hello and salutation is Hello, Hello.
  • D. Greeting is Goodbye and salutation is I say Hello.

Answer: C


NEW QUESTION # 65
Which statement accurately describes the behaviour of the async/ await keyworks ?

  • A. The associated function will always return a promise
  • B. The associated class contains some asynchronous functions.
  • C. The associated function can only be called via asynchronous methods
  • D. The associated sometimes returns a promise.

Answer: D


NEW QUESTION # 66
A developer writers the code below to calculate the factorial of a given number.
Function factorial(number) {
Return number + factorial(number -1);
}
factorial(3);
What is the result of executing line 04?

  • A. 0
  • B. 1
  • C. -Infinity
  • D. RuntimeError

Answer: D


NEW QUESTION # 67
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" ?

  • A. Change line 7 to ) () ;
  • B. Change line 9 to sayHello(world) ();
  • C. Change line 2 to console.log('Hello' ,name() );
  • D. Change line 5 to function world ( ) {

Answer: C


NEW QUESTION # 68
A developer creates an object where its properties should be immutable and prevent properties from being added or modified.
Which method should be used to execute this business requirement?

  • A. Object. filebase ( )
  • B. Object. real ( )
  • C. Object const ( )
  • D. Object. Lock ( )

Answer: A


NEW QUESTION # 69
A developer wants to use a module called DataPrettyPrint. This module exports one default functioncalled printDate ().
How can a developer import and use the printDate() function?

  • A.
  • B.
  • C.
  • D.

Answer: C


NEW QUESTION # 70
A developer wrote the following code to test a sum3 function that takes in an array of numbers and returns the sum of the first three numbers in the array, and the test passes.
A different developer made changes to the behavior of sum3 to instead sum only the first two numbers present in the array.

Which two results occur when running this test on the updated sum3 function?
Choose 2 answers

  • A. The line 02 assertion passes.
  • B. The line 05 assertion fails.
  • C. The line 02 assertion fails.
  • D. The line 05 assertion passes.

Answer: A,B


NEW QUESTION # 71
developer uses the code below to format a date.

After executing, what is the value offormattedDate?

  • A. November 05, 2020
  • B. May 10, 2020
  • C. October 05, 2020
  • D. June 10, 2020

Answer: D


NEW QUESTION # 72
......

JavaScript-Developer-I Dumps PDF - 100% Passing Guarantee: https://braindumps.getvalidtest.com/JavaScript-Developer-I-brain-dumps.html