-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
87 lines (58 loc) · 1.66 KB
/
script.js
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// var years=[1995,2000,2001,1945,1932,1993,1997,1971,1952];
// function age(value,value1){
// var emptyage=[];
// for(var i=0; i< value.length;i++){
// emptyage.push(value1(value[i]));
// }
// return emptyage;
// }
// function agecount(value){
// return 2020-value;
// }
// function agelimit(value){
// if(value>=18 && value <=81){
// console.log(' your age is ok '+value);
// }
// else{
// if(value<18){
// console.log(' your age 18 chite choto ='+value);
// }
// else{
// console.log(' apnar age 81 bashi ='+value);
// }
// }
// }
// var totalage =age(years,agecount);
// var totalagelimit=age(totalage,agelimit);
// console.log(totalage);
// console.log(totalagelimit);
var all ={
years :[1995,2000,2001,1945,1932,1993,1997,1971,1952],
age: function(value,value1){
var emptyage=[];
for(var i=0; i< value.length;i++){
emptyage.push(value1(value[i]));
}
return emptyage;
},
agecount:function(value){
return 2020-value;
},
agelimit:function(value){
if(value>=18 && value <=81){
console.log(' your age is ok '+value);
}
else{
if(value<18){
console.log(' your age 18 chite choto ='+value);
}
else{
console.log(' apnar age 81 bashi ='+value);
}
}
}
}
var showage =all.age(all.years,all.agecount);
var limitage =all.age(showage,all.agelimit);
console.log(showage);
console.log(limitage);