Salesforce Certified JavaScript Developer I Practice Test - Questions Answers, Page 10
List of questions
Related questions
Given the code below: const copy = JSON.stringify([ new String(' false '), new Bollean( false ), undefined ]); What is the value of copy?
The developer wants to test the array shown: const arr = Array(5).fill(0) Which two tests are the most accurate for this array ?
Choose 2 answers:
A developer receives a comment from the Tech Lead that the code given below has error:
error:
const monthName = 'July';
const year = 2019;
if(year === 2019) {
monthName = 'June';
Which line edit should be made to make this code run?
Refer to the following code:
<html lang="en">
<body>
<div onclick = "console.log('Outer message') ;">
<button id ="myButton">CLick me<button>
</div>
</body>
<script>
function displayMessage(ev) {
ev.stopPropagation();
console.log('Inner message.');
}
const elem = document.getElementById('myButton');
elem.addEventListener('click' , displayMessage);
</script>
</html> What will the console show when the button is clicked?
Refer to the code below: function foo () { const a =2; function bat() { console.log(a);
} return bar;
} Why does the function bar have access to variable a ?
Given the following code:
document.body.addEventListener(' click ', (event) => {
if (/* CODE REPLACEMENT HERE */) {
console.log('button clicked!');
)
});
Which replacement for the conditional statement on line 02 allows a developer to correctly determine that a button on page is clicked?
Given the following code:
document.body.addEventListener(' click ', (event) => {
if (/* CODE REPLACEMENT HERE */) {
console.log('button clicked!');
)
});
Which replacement for the conditional statement on line 02 allows a developer to correctly determine that a button on page is clicked?
Universal Container(UC) just launched a new landing page, but users complain that the website is slow. A developer found some functions that cause this problem. To verify this, the developer decides to do everything and log the time each of these three suspicious functions consumes.
console.time('Performance');
maybeAHeavyFunction();
thisCouldTakeTooLong();
orMaybeThisOne();
console.endTime('Performance');
Which function can the developer use to obtain the time spent by every one of the three functions?
Refer to the code below:
console.log(''start);
Promise.resolve('Success') .then(function(value){
console.log('Success');
});
console.log('End');
What is the output after the code executes successfully?
Refer to HTML below:
<div id ="main">
<div id = " card-00">This card is smaller.</div>
<div id = "card-01">The width and height of this card is determined by its contents.</div>
</div> Which expression outputs the screen width of the element with the ID card-01?
Question