Your robot will need to start executing custom tasks, and to do that, you'll need to program its `functions`. Functions are like commands that tell robot exactly what to do.
You can create your own functions to give your robot unique abilities and make it more efficient!
This type of prompt encourages you to reflect on the concepts you’ve just learned, reinforcing your understanding by applying the concepts in different contexts or scenarios.
console.log("Hello There !"); // <-functioncallhappeninghere
// ↖ open paren + argument + close paren
```
There, we saw how to call and use "built-in" functions.
Here, now, we are going to learn how to declare our owns. This will gives us even more freedom to build our own logic.
### Declaring a function
Here, we’ll learn how to declare a function in a `variable`. This gives your robot more freedom to perform custom tasks.
We'll use the `ArrowFunctionExpression` syntax to declare a function:
```js
// ↙ normal variable ↙ beginning of the scope of the function
let myFirstFunction = () => {
// ↖ parens () for arguments and the arrow => for syntax
}; // <-endofthescopeofthefunction
```
### Calling a Function
Once declared, you can call the function using the parentheses `()`:
```js
myFirstFunction(); // This will call the function, but nothing happens yet
```
### Adding Instructions
Very much like an if statement a function has a scope. The scope in between the curly braces `{}` is where the action happens. Let's add something to the scope of our function:
```js
let myFirstFunction = () => {
console.log("Robot is now active!");
};
```
Now, when you call `myFirstFunction()`, Robot will log a message in the console: