Description
Getting started
Please please please read the docs before starting. Posting PRs without reading these docs will be a lot more frustrating for you during the review cycle, and exhaust Exercism's maintainers' time. So, before diving into the implementation, please read up on the following documents:
- Rationale for v3.
- The features of v3
- What are concepts and how they are structured?
- What are concept exercises and how they are structured?
Please also watch the following video:
See the documentation above (general documentation), as well as How to implement a Concept Exercise in JavaScript.
Goal
Functions were already briefly mentioned in the basics concept. The goal of this exercise is to give a proper introduction to functions so the student is prepared to get introduced to callbacks in a later concept exercise.
Concepts
The following concept page need to be created. You can use the same content for the introduction.md of the concept and the concept exercise. No need to create different content at this point.
functions
Learning Objectives
In the concept/introduction the student should learn about the following things and then practice them in the concept exercise.
- How to define a function (it is probably ok to repeat the basics in some more detail here)
- All arguments are optional in JS
- What happens if the function is called with fewer or more arguments than mentioned in the function definition
- How to set default parameters
- Return an object if you want to return multiple values
- Pass by value vs. pass by reference
- Functions are first-class objects (can be assigned to variables, passed around etc.)
- Function Scope
- What happens if there is no return statement
Out of Scope
The following topics will be introduced later and should therefore not be part of this concept exercise.
- Rest parameters
- Callbacks
- Methods
- Arrow functions (will be introduced later together with callbacks)
- Recursion
- Closures
- Higher Order Functions
About.md of the Concept
Here some ideas of what could be mentioned.
- Anonymous functions
- Talk about hoisting, explain that function declarations are hoisted, function expressions are not
- Arguments array
Prerequisites
objects
null-undefined
See this list for details on the learning curve we are aiming for.
Exercise Idea
This concept is very special to JS so there is probably no fitting exercise in other tracks to use as a template and the exercise needs to be created from scratch. As general inspiration for the story, Lasanga Master might help.
Help
You can choose to do this solo-style, or collaborate with multiple people on this. The suggested approach is to
- First accept this issue by saying "I'd like to work on this" (you will not get a response, just go with it) and optionally request that someone works with you (and wait for a second person to accept your request).
- Use this issue to write down what you need (collect reference material) and discuss, if necessary, what to write and what not to write.
- Draft a PR and request the feedback from at least one other JavaScript member (you can ping the #maintaining-javascript channel in Slack).