Skip to content

Commit c5a1491

Browse files
committed
functions intro
1 parent 480dbae commit c5a1491

2 files changed

Lines changed: 47 additions & 0 deletions

File tree

typescript/functions/main.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"use strict";
2+
exports.__esModule = true;
3+
var greed = function () {
4+
console.log("Hello");
5+
};
6+
greed();
7+
console.log(typeof greed);
8+
var greed2;
9+
greed2 = function () {
10+
console.log("Hello again");
11+
};
12+
greed2();
13+
var square = function (a) {
14+
console.log(a * a);
15+
};
16+
square(4);
17+
var sRoot = function (a) {
18+
return Math.sqrt(a);
19+
};
20+
var sqrtX = sRoot(100);
21+
console.log(sqrtX);

typescript/functions/main.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
export{}
2+
3+
let greed = () => {
4+
console.log("Hello")
5+
}
6+
greed()
7+
console.log(typeof greed)
8+
9+
let greed2: Function
10+
11+
greed2 = () => {
12+
console.log("Hello again")
13+
}
14+
greed2()
15+
16+
let square: Function = (a: number) : void => {
17+
console.log(a*a)
18+
}
19+
square(4)
20+
21+
const sRoot: Function = (a: number) : number => {
22+
return Math.sqrt(a)
23+
}
24+
25+
let sqrtX = sRoot(100)
26+
console.log(sqrtX)

0 commit comments

Comments
 (0)