BlackFriday 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
2 months ago
I'm not sure, but I think substr(1, 5) and substring(0, 5) would give us 'Sales'.
upvoted 0 times
...
Tasia
2 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
2 months ago
I think the correct answers are B) and D)
upvoted 0 times
...
Elfrieda
2 months ago
Oh, I see your point. Thanks for clarifying.
upvoted 0 times
...
Gabriele
2 months ago
But substr() includes the starting index, while substring() does not. So, A) and B) are correct.
upvoted 0 times
...
Elfrieda
2 months ago
I disagree, I believe it's C) and D)
upvoted 0 times
...
Gabriele
2 months ago
I think the answer is A) and B)
upvoted 0 times
...
Fidelia
3 months ago
Definitely B) and D). Anything else would be 'Sales'-ing yourself short!
upvoted 0 times
Christene
2 months ago
D) str.substring (0, 5);
upvoted 0 times
...
Art
2 months ago
Definitely B) and D). Anything else would be 'Sales'-ing yourself short!
upvoted 0 times
...
Florinda
2 months ago
B) str.substr (0, 5);
upvoted 0 times
...
Joanna
2 months ago
A) str.substr(1, 5);
upvoted 0 times
...
...
Kaitlyn
3 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
3 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
2 months ago
C) str.substring (1, 5);
upvoted 0 times
...
Dalene
3 months ago
A) str.substr(1, 5);
upvoted 0 times
...
...
Rodrigo
3 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
2 months ago
B) str.substr (0, 5);
upvoted 0 times
...
Dominga
3 months ago
A) str.substr(1, 5);
upvoted 0 times
...
...

Save Cancel