Defining Functions

Defining Functions

Functions are reusable blocks of code:

function greet(name) {\n  return "Hello, " + name + "!";\n}\nconsole.log(greet("Shinobi")); // Hello, Shinobi!

You can also use arrow functions:

const greet = (name) => `Hello, ${name}!`;
Sign in to track your progress.

Q&A / Discussion

No comments yet. Be the first to ask a question!

Sign in to join the discussion.