# FAQ: Functions - Arrow Functions

This community-built FAQ covers the “Arrow Functions” exercise from the lesson “Functions”.

Paths and Courses
This exercise can be found in the following Codecademy content:

## FAQs on the exercise Arrow Functions

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

## Join the Discussion. Help a fellow learner on their journey.

Agree with a comment or answer? Like () to up-vote the contribution!

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Hello, I am Claudia and I’m having a problem with the arrow function exercise: I can not find the fat arrow in my Mac Pro so I can not do the exercise. I am new to coding but have been studying javascript, the basics. Someone knows how can I get a fat arrow?
cordially,
Claudia

2 Likes

that is because there isn’t one key for it, there are two: equal sign (`=`) and greater then symbol (`>`). Both these keys should be present on your keyboard

5 Likes

Hi i want to know if i can use the arrow function to a nornal function or only to expression functions
thanks

Arrow functions can only be expressions, not declarations.

``````function foo() {
// declared function
}

const foo = function() {
// function expression
}

const foo = () => {
// arrow function expression
}
``````

E S6 Arrow Functions: Fat and Concise Syntax in JavaScript

From the above article…

Decision flow chart

7 Likes

I’ve been working on the Introduction To JavaScript course, and on this one (as well as a few others), it says I am getting it wrong even though my answer is the exact same as the solution.

Is this happening to anyone else? Is this still somehow an error on my end? Or is there somewhere I can report this issue to codecademy themselves?

1 Like

Hello, @33caitst! Welcome to the forum!
If you click on the `Get Help` icon in the lower right corner of the screen, you can submit a bug report to the Codecademy Team. I know it’s frustrating to click on the `Solution` button when your code works. There are occasions when we may have left something out of a string literal like `'Hello World!'` when the SCT is expecting `'Hello, World!'` Sometimes we name a variable incorrectly, or have other minor issues that aren’t errors that prevent the code from working, but don’t exactly match what the SCT for the lesson is expecting. I only say all of that to caution against submitting bug reports when you may have missed something. There definitely are legitimate bugs though, and submitting a bug report along with posting specifics to the forum are perfectly acceptable courses of action. If you do post a suspected bug to the forum, make sure to include a link to the lesson in question, so others can see if they experience the same behavior.
Happy coding!

We see a great many learners come here with very high expectations, only to have to assuage them when they meet with disappointment. These expectations can swing one of two ways:

• expecting the course to be all encompassing and deliver a full meal deal (externalized expectation)
• expecting ourselves to learn quickly and without making any mistakes (internalized expectation).

Nothing leads to disappointment faster then unreasonable expectations (either of the above), as we all learn by some point in life. The earlier, the better.

Bottom line, the Solution is your friend, not something to be avoided any more than using the hints. They are given for a reason. This is not a contest and there is no prize at the end of it all. Just a clearer vision, for most. Those who give up, of course are still blind to what their own potential is.

4 Likes

Good evening.
Is there any advantage of using the Arrow Functions method, over the other two methods?

In certain circumstances, definitely, brevity and conciseness being among the advantages. Higher order functions are another instance where the briefness makes for simplicity of both operation and reading/writing. The relaxed syntax plays right into that.

It is not a be-all and end-all, though, so we won’t be tossing the baby with the bathwater. Multiple statement functions can be just as well written in ES5 syntax if arrow syntax doesn’t simplify it to any great degree.

``````function multiply(a, b) {
return a * b;
}
const multiply = function(a, b) {
return a * b;
}
const multiply = (a, b) => a * b;
``````

Note how the transformation from declarative to expressive to arrow expression occurs seamlessly. In situations where it is easy to transform as such, then we can leverage the simpler syntax.

1 Like

In a few of the activities like Arrow Functions on intro to JavaScript
when i use => (fat arrow) it comes up with syntax error.
However the solution is the same as what i put, thought it was a one off issue so i reset the workspace and it did the same thing.
There a few bugs that need to be solved because, its quite annoying being told you’re wrong when the solution is the exact same as your answer.

1 Like

Same here. Syntax error even though I got a green check mark on the Instruction Step.

The requirement (using arrow function) is met, as such, the exercise gives you a pass.

But the error message I also understand, why would you want to overwrite the parameter? This means, whatever value is provided, is just discarded.

10 posts were split to a new topic: What would happen if we didn’t omit the return keyword

I have tried to use Ternary Operator to write this piece of code :
but I got an error in Editor, can anyone help me please?

const plantNeedsWater = (day) => {
day === “Wednesday” ? return true : return false;
}

console.log(plantNeedsWater(‘Wednesday’));

Ternary expressions are generally either assigned or returned. What you are trying to do would look like this:

``````return day === "Wednesday" ? true : false;
``````

There is a better way, however. The evaluated expression will be returned, so you don’t need the ternary expression.

``````const plantNeedsWater = day => day === 'Wednesday'; //the result, true or false will be returned
``````
2 Likes

Thank you for the examples! Why does the latest expression does not use {}?

It is the simplest form of the concise body function syntax. We are able to assign an arrow function expression which itself returns a single expression.

Consider,

``````const f = function (param) {
return expression;
}

// vs.

const g = param => expression;
``````

Given the above overall make up, a single parameter needs no parens, and a single return expression requires neither return keyword not body tokens (curly braces). `return` is implicit.

2 Likes

Now it makes cense! Thanks.

1 Like