Cyber Monday 2024! 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]

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:

Teddy
3 months ago
I'm not sure, but I think substr(1, 5) and substring(0, 5) would give us 'Sales'.
upvoted 0 times
...
Tasia
3 months ago
I agree with Gail, because substr starts at the specified index and extracts the specified number of characters, while substring extracts characters between two specified indices.
upvoted 0 times
...
Gail
3 months ago
I think the correct answers are B) and D)
upvoted 0 times
...
Elfrieda
3 months ago
Oh, I see your point. Thanks for clarifying.
upvoted 0 times
...
Gabriele
3 months ago
But substr() includes the starting index, while substring() does not. So, A) and B) are correct.
upvoted 0 times
...
Elfrieda
3 months ago
I disagree, I believe it's C) and D)
upvoted 0 times
...
Gabriele
3 months ago
I think the answer is A) and B)
upvoted 0 times
...
Fidelia
4 months ago
Definitely B) and D). Anything else would be 'Sales'-ing yourself short!
upvoted 0 times
Christene
3 months ago
D) str.substring (0, 5);
upvoted 0 times
...
Art
3 months ago
Definitely B) and D). Anything else would be 'Sales'-ing yourself short!
upvoted 0 times
...
Florinda
3 months ago
B) str.substr (0, 5);
upvoted 0 times
...
Joanna
3 months ago
A) str.substr(1, 5);
upvoted 0 times
...
...
Kaitlyn
4 months ago
Ah, the good old 'substr' vs 'substring' debate. I'm going with B) and D) - they just roll off the tongue, you know?
upvoted 0 times
...
Joni
4 months ago
Hmm, I think B) and D) are the way to go. Who needs 'substr' when you've got 'substring'? It's like having two spoons when one will do!
upvoted 0 times
Bo
3 months ago
C) str.substring (1, 5);
upvoted 0 times
...
Dalene
4 months ago
A) str.substr(1, 5);
upvoted 0 times
...
...
Rodrigo
4 months ago
The correct answers are B) and D). 'substr' and 'substring' both return the characters from the specified indices, but 'substr' takes the length as the second argument, while 'substring' takes the end index.
upvoted 0 times
Merlyn
3 months ago
B) str.substr (0, 5);
upvoted 0 times
...
Dominga
4 months ago
A) str.substr(1, 5);
upvoted 0 times
...
...

Save Cancel