forked from amitsrivastava4all/UiCodes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LooslyTyped.html
52 lines (43 loc) · 1.04 KB
/
LooslyTyped.html
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
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>
</title>
<script>
function add(){
var sum = 0;
if(arguments){
for(var i = 0; i<arguments.length; i++){
if(typeof arguments[i]==="function"){
sum= sum + arguments[i]();
}
else
if(arguments[i] instanceof Array){
var z = arguments[i];
for(var j = 0; j< z.length; j++){
sum = sum + z[j];
}
}
else{
sum= sum + arguments[i];
}
}
}
return sum ;
}
/* function add(x,y){
//truthy and falsy
if(!x){
x = 0;
}
if(!y){
y = 0;
}
return x + y;
}*/
</script>
</head>
<body>
</body>
</html>