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

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

Refer to the code below:

const addBy = ?

const addByEight =addBy(8);

const sum = addBYEight(50);

Which two functions can replace line 01 and return 58 to sum?

Choose 2 answers

Show Suggested Answer Hide Answer
Suggested Answer: A, D

Contribute your Thoughts:

Lou
3 months ago
I'm hungry just looking at this code. I wonder if there's a function that can add some snacks to the mix?
upvoted 0 times
...
Emile
3 months ago
Aha, Option D looks like the winner! Currying is the way to go here, nice and concise.
upvoted 0 times
...
Elly
3 months ago
Option C is interesting, but I'm not sure about the use of 'num2' when it's not defined. Hmm, curious.
upvoted 0 times
Aileen
3 months ago
D) const addBY = (num1) => (num2) => num1 + num2;
upvoted 0 times
...
Ronny
3 months ago
A) const addBy = function(num1){\nreturn function(num2){\nreturn num1 + num2;\n}
upvoted 0 times
...
...
Lettie
3 months ago
Option B is a no-go, it's missing a parameter. How can we add without a second number?
upvoted 0 times
Lenita
3 months ago
Yeah, option B is definitely not the right choice. We need that second parameter to add the numbers together.
upvoted 0 times
...
Carlota
3 months ago
C) const addBy = (num1) => num1 + num2 ;
upvoted 0 times
...
Armando
3 months ago
A) const addBy = function(num1){\nreturn function(num2){\nreturn num1 + num2;\n}
upvoted 0 times
...
...
Hannah
4 months ago
Option A looks good, but why do we need a nested function? Seems a bit overkill for such a simple task.
upvoted 0 times
Lisha
3 months ago
It's a matter of preference, some developers prefer nested functions for clarity.
upvoted 0 times
...
Jenelle
3 months ago
Nested functions can help with code organization and readability.
upvoted 0 times
...
Irene
3 months ago
Option A is more flexible and allows for currying, which can be useful in certain situations.
upvoted 0 times
...
...
Sage
4 months ago
I think option A and D are correct because they both return a function that adds two numbers.
upvoted 0 times
...
Cordelia
4 months ago
I'm not sure, but I think option B and C might work too.
upvoted 0 times
...
Chantell
4 months ago
I agree with Annett, option A and D both return the sum of two numbers.
upvoted 0 times
...
Annett
4 months ago
I think option A and D can replace line 01.
upvoted 0 times
...

Save Cancel