...

/

Introduction to Functions

Introduction to Functions

Learn one of the fundamental building blocks of all languages: functions. Learn how to write a function, why they're useful, and what we can do with them.

We'll cover the following...

We now get to one of the topics that new programmers find most difficult. Once the understanding sinks in, however, it’ll feel trivial. You’ll write functions pretty much every single day that you write code.

Let’s show some code and then discuss what’s happening.

Press + to interact
function myFirstFunction() {
console.log('Just ran my first function!');
}
myFirstFunction(); // -> Just ran my first function!

Creating a Function

To write a function, we start with the function keyword. We write the name we want to give the function after it. We write a pair ...

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy