-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.html
56 lines (41 loc) · 870 Bytes
/
example.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
53
54
55
56
<html>
<head>
</head>
<body>
<pre id="output"></pre>
<script src="getType.js"></script>
<script>
var undef;
var arr = [
'hello github',
1337,
false,
1.2,
{},
[1, 2],
null,
undef,
new RegExp('0-9'),
function(){},
new Date('2013-04-09'),
new Error('something is wrong here!')
];
document.getElementById('output').innerHTML=arr.map(function(cur){return cur + ' => ' + getType(cur);}).join('<br><br>');
/*
OUTPUT WILL BE:
hello github => string
1337 => number
false => boolean
1.2 => float
[object Object] => object
1,2 => array
null => null
undefined => undefined
/0-9/ => regexp
function (){} => function
Tue Apr 09 2013 02:00:00 GMT+0200 (Mitteleuropäische Sommerzeit) => date
Error: something is wrong here! => error
*/
</script>
</body>
</html>