-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharray-comp.html
46 lines (43 loc) · 1.25 KB
/
array-comp.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
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Array comparison</title>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
var rose = ['sweet'];
var flinchgrokkel = ['sweet'];
var poesy = ['sweet', 'difficult to spell'];
function desc(arr){
if(arr === []) return '[]';
return "['"+arr.join("', '")+"']";
};
$('#output').append(
$('<pre />').text('var rose = '+desc(rose)+';')
).append(
$('<pre />').text('var flinchgrokkel = '+desc(flinchgrokkel)+';')
).append(
$('<pre />').text('var poesy = '+desc(poesy)+';')
).append(
$('<pre />').text('rose == flinchgrokkel // '+(rose == flinchgrokkel))
).append(
$('<pre />').text('rose == poesy // '+(rose == poesy))
).append(
$('<pre />').text('rose === flinchgrokkel // '+(rose === flinchgrokkel))
).append(
$('<pre />').text('rose === poesy // '+(rose === poesy))
).append(
$('<pre />').text('{foo:1} == {foo:1} // '+({foo:1}=={foo:1}))
).append(
$('<pre />').text('[] == [] // '+([]==[]))
);
});
</script>
</head>
<body>
<h1>Array comparison</h1>
<p>There is no built-in array comparison in JavaScript.</p>
<div id="output"></div>
</body>
</html>