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 96 Discussion

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

Refer to the string below:

const str = 'Salesforce';

Which two statements result in the word 'Sales'?

Choose 2 answers

Show Suggested Answer Hide Answer
Suggested Answer: B, D

Contribute your Thoughts:

Princess
9 days ago
Is there a 'none of the above' option? I feel like I'm just guessing here. Oh well, at least I get to practice my comedy skills with this exam question.
upvoted 0 times
...
Laila
12 days ago
B) and D) both look good to me. I'm just glad I don't have to remember the difference between substr() and substring() on the job.
upvoted 0 times
...
Lore
24 days ago
Hmm, I'm not sure. I always get these string methods mixed up. Maybe I should have paid more attention in my JavaScript class.
upvoted 0 times
Jennifer
3 days ago
D) str.substring (0, 5);
upvoted 0 times
...
Iraida
15 days ago
A) str.substr(1, 5);
upvoted 0 times
...
...
Chery
29 days ago
I'm not sure, but I think C) might also be correct because substring also extracts characters between two specified indices.
upvoted 0 times
...
Veda
1 months ago
D) str.substring(0, 5) also looks good to me. Both substring() and substr() methods can be used to extract a substring, but I prefer substring() as it's more widely used.
upvoted 0 times
...
Ilda
1 months ago
I agree with Wilbert, because substr starts at the specified index and extracts a specified number of characters, while substring extracts characters between two specified indices.
upvoted 0 times
...
Chan
1 months ago
I think B) str.substr(0, 5) is the correct answer, as it extracts the substring from the 0th index to the 4th index, which gives us 'Sales'.
upvoted 0 times
Domitila
21 days ago
Yes, D) str.substring(0, 5) also results in 'Sales'.
upvoted 0 times
...
Alita
24 days ago
B) str.substr (0, 5);
upvoted 0 times
...
Paris
24 days ago
I agree, B) str.substr(0, 5) is correct.
upvoted 0 times
...
Mica
25 days ago
A) str.substr(1, 5);
upvoted 0 times
...
...
Wilbert
1 months ago
I think the correct answers are B) and D)
upvoted 0 times
...

Save Cancel