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 4 Question 97 Discussion

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

Refer to the code snippet:

Function getAvailabilityMessage(item) {

If (getAvailability(item)){

Var msg =''Username available'';

}

Return msg;

}

A developer writes this code to return a message to user attempting to register a new

username. If the username is available, variable.

What is the return value of msg hen getAvailabilityMessage (''newUserName'' ) is

executed and getAvailability(''newUserName'') returns false?

Show Suggested Answer Hide Answer
Suggested Answer: A

Contribute your Thoughts:

Ilene
1 hours ago
Hah! Looks like the developer forgot to handle the case where the username is not available. I bet they're feeling a bit 'unavailable' right now.
upvoted 0 times
...
Scarlet
4 days ago
The code snippet is missing a crucial step. It should have checked the value of getAvailability('newUserName') and then assigned the appropriate message to the msg variable before returning it.
upvoted 0 times
...
Vanda
6 days ago
If getAvailability('newUserName') returns false, then the if condition will not be true, and the variable msg will not be assigned a value. Therefore, the return value will be undefined.
upvoted 0 times
...
Kiley
15 days ago
I'm not sure, but I think the answer might be C) 'Msg is not defined'.
upvoted 0 times
...
Alisha
20 days ago
I agree with Hoa, because if getAvailability returns false, msg won't be defined.
upvoted 0 times
...
Hoa
27 days ago
I think the answer is D) undefined.
upvoted 0 times
...

Save Cancel
az-700  pass4success  az-104  200-301  200-201  cissp  350-401  350-201  350-501  350-601  350-801  350-901  az-720  az-305  pl-300  

Warning: Cannot modify header information - headers already sent by (output started at /pass.php:70) in /pass.php on line 77