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
1 months 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
1 months 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
Scarlet
8 days ago
B) and D) are correct. Substr() counts from the starting index, while substring() counts from the starting index to the end index.
upvoted 0 times
...
Alishia
9 days ago
D) str.substring (0, 5);
upvoted 0 times
...
Johna
10 days ago
C) str.substring (1, 5);
upvoted 0 times
...
Melodie
13 days ago
B) str.substr (0, 5);
upvoted 0 times
...
Garry
1 months ago
A) str.substr(1, 5);
upvoted 0 times
...
...
Lore
2 months 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
Aleisha
22 days ago
Yes, those are the correct answers!
upvoted 0 times
...
Tommy
27 days ago
I think it's A) and D)
upvoted 0 times
...
Jennifer
1 months ago
D) str.substring (0, 5);
upvoted 0 times
...
Iraida
2 months ago
A) str.substr(1, 5);
upvoted 0 times
...
...
Chery
2 months 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
2 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
2 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
2 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
2 months ago
Yes, D) str.substring(0, 5) also results in 'Sales'.
upvoted 0 times
...
Alita
2 months ago
B) str.substr (0, 5);
upvoted 0 times
...
Paris
2 months ago
I agree, B) str.substr(0, 5) is correct.
upvoted 0 times
...
Mica
2 months ago
A) str.substr(1, 5);
upvoted 0 times
...
...
Wilbert
2 months ago
I think the correct answers are B) and D)
upvoted 0 times
...

Save Cancel