Skip to content

Commit 83e8ff2

Browse files
feat: add arrow functions
1 parent e7918e4 commit 83e8ff2

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
:INFO: 🏹 What is an Arrow Function?
3+
Arrow functions are a concise syntax for writing functions introduced in ES6. They are great for writing short functions and callbacks.
4+
*/
5+
6+
// Syntax
7+
const functionName = (parameters) => {
8+
console.log("Hi");
9+
};
10+
11+
// Example
12+
const greet = (name) => {
13+
console.log(`Hello, ${name}`);
14+
};
15+
greet("Rafay");
16+
17+
// One-liner return (implicit return)
18+
const square = n => n * n;
19+
console.log(square(5));

0 commit comments

Comments
 (0)