Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Salesforce Exam Javascript Developer I Topic 2 Question 86 Discussion

Actual exam question for Salesforce's Javascript Developer I exam
Question #: 86
Topic #: 2
[All Javascript Developer I Questions]

A developer at Universal Containers is creating their new landing pagebased on HTML, CSS, and JavaScript. The website includes multiple external resources that are loaded when the page is opened.

To ensure that visitors have a good experience, a script named personalizeWebsiteContent needs to be executed when the webpage isloaded and there is no need to wait for the resources to be available.

Which statement should be used to call personalizeWebsiteContent based on the above business requirement?

Show Suggested Answer Hide Answer
Suggested Answer: B, D

Contribute your Thoughts:

Colette
30 days ago
Option A is the way to go, folks. It's like a superhero swooping in to save the day, personalized content for everyone, no matter how slow the resources may be!
upvoted 0 times
Vincent
3 days ago
C) windows,addEventListener('onload', personalizeWebsiteContent);
upvoted 0 times
...
Allene
12 days ago
B) windows,addEventListener('DOMContent Loaded ', personalizeWebsiteContent);
upvoted 0 times
...
Glenna
16 days ago
A) windows,addEventListener('load', personalizeWebsiteContent);
upvoted 0 times
...
...
Alonzo
1 months ago
C and D are both wrong because `onload` and `onDOMContentLoaded` are not valid event listeners. You need to use the `addEventListener` method instead.
upvoted 0 times
Isadora
3 days ago
C and D are both wrong because `onload` and `onDOMContentLoaded` are not valid event listeners. You need to use the `addEventListener` method instead.
upvoted 0 times
...
Jacquline
6 days ago
B) windows,addEventListener('DOMContent Loaded ', personalizeWebsiteContent);
upvoted 0 times
...
Gerald
14 days ago
A) windows,addEventListener('load', personalizeWebsiteContent);
upvoted 0 times
...
...
Leontine
1 months ago
I'm going to go with option A. `window.addEventListener('load', personalizeWebsiteContent)` is the way to go. I mean, who wants to wait for all those resources to load before personalizing the website? Not me, that's for sure!
upvoted 0 times
Aleta
14 days ago
Definitely option A. It's important to personalize the website content without making visitors wait.
upvoted 0 times
...
Colton
16 days ago
I agree, option A is the way to go. It ensures a good user experience.
upvoted 0 times
...
Erin
27 days ago
Option A is the best choice. You don't want visitors waiting for all those resources to load.
upvoted 0 times
...
...
Lorrie
2 months ago
Option B is incorrect because `DOMContentLoaded` is triggered when the initial HTML document has been completely loaded and parsed, but before all the resources (such as stylesheets and images) have finished loading.
upvoted 0 times
Phil
3 days ago
D) windows,addEventListener('onDOMCContentLoaded', personalizeWebsiteContent);
upvoted 0 times
...
Felice
10 days ago
C) windows,addEventListener('onload', personalizeWebsiteContent);
upvoted 0 times
...
Geraldine
13 days ago
B) windows,addEventListener('DOMContent Loaded ', personalizeWebsiteContent);
upvoted 0 times
...
Casandra
1 months ago
A) windows,addEventListener('load', personalizeWebsiteContent);
upvoted 0 times
...
...
Mari
2 months ago
The correct answer is A. The `load` event is the correct one to use when you want to execute a script as soon as the page is loaded, regardless of when the external resources are available.
upvoted 0 times
...
Yolande
2 months ago
But wouldn't using 'load' ensure that the script is executed when all resources are loaded, providing a better user experience?
upvoted 0 times
...
Junita
2 months ago
I disagree, I believe the correct answer is B) windows,addEventListener('DOMContent Loaded ', personalizeWebsiteContent);
upvoted 0 times
...
Yolande
3 months ago
I think the answer is A) windows,addEventListener('load', personalizeWebsiteContent);
upvoted 0 times
...

Save Cancel