-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFunction.ts
More file actions
41 lines (33 loc) · 837 Bytes
/
Function.ts
File metadata and controls
41 lines (33 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//Map Function
var arr3=[10,20,30,40,50,60];
// var temp=arr3.map((myvalue)=>{
// return(myvalue*myvalue);
// });
// console.log(arr3);
// console.log(temp);
console.log("---------------------------------------------");
var temp2=arr3.map((Element,i)=>{
if(i==2||i==4){
return(Element*Element)
}
});
console.log("original Array"+arr3);
console.log(temp2);
//////Custom Function
function getSquare(Element:number){
return(Element*Element);
}
var temp4=arr3.map(getSquare);
console.log(temp4.join(" "));
//Tuple
var temp5=[2,"5",true,3.14]
console.log(temp5.join(" "));
//==,=== operator
//==-it check the data of variable to compare the data
//===-it check as data as well as DataType
var i:number=2;
if(i==2){
console.log("true");
}else{
console.log("flase");
}