Skip to content

Commit 75a1cea

Browse files
feat: add return statement
1 parent 126587f commit 75a1cea

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
INFO: What is the return statement ?
3+
The return statement is used to output a value from a function and terminate its execution.
4+
*/
5+
6+
// Syntax
7+
function add(a, b) {
8+
return a + b;
9+
}
10+
let ans = add(2, 2);
11+
console.log(ans);
12+
13+
// Example
14+
function greet() {
15+
return "Hello!";
16+
}
17+
let message = greet();
18+
console.log(message);

0 commit comments

Comments
 (0)