Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
78 lines (68 loc) · 2.54 KB

File metadata and controls

78 lines (68 loc) · 2.54 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>JS Comparison Table</title>
<link rel="stylesheet" href="styles/simple.css" type="text/css" media="all" title="simple" charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="js/comparison_table.js"></script>
<!-- Originally from here:
http://blog.codekills.net/archives/89-Equality-in-JavaScript.html
2013-Nov-11. Correcting issue where "[]===[]" was incorrectly marked as true.
Converted from this gist:
https://gist.github.com/761080
-->
</head>
<body>
<div id="tabs">
<ul>
<li>
<a href="#two-equals">
==
</a>
</li>
<li>
<a href="#three-equals">
===
</a>
</li>
<li>
<a href="#if-statement">
If()
</a>
</li>
</ul>
<div id="two-equals">
<h2>== <smaller>(negated: !=)</smaller></h2>
<p class="description">
When using two equals signs for JavaScript equality testing, some funky conversions take place.
</p>
</div>
<div id="three-equals">
<h2>=== <smaller>(negated: !==)</smaller></h2>
<p class="description">
When using three equals signs for JavaScript equality testing, everything is <b>as is</b>. Nothing gets converted before being evaluated.
</p>
</div>
<div id="if-statement">
<h2>A standard IF statement. If(<i>value</i>) {/*- green -*/} else { /*- white -*/ }</h2>
<p>Note: This row does not match up with any of the rows in the other table.</p>
</div>
<div style="padding: 2px 20px">
<h4>Moral of the story:</h4>
<p>Use three equals unless you fully understand the conversions that take place for two-equals.</p>
</div>
</div>
<!-- see values.js for a list of values which are compared in the table -->
<script src="values.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
buildComparisonTable(values, "==").appendTo("#two-equals")
buildComparisonTable(values, "===").appendTo("#three-equals")
buildComparisonTableForIf(values).appendTo("#if-statement")
$('#tabs').tabs();
$("<li><a href='unified/'>New link: view everything in one table</a></li>").appendTo("#tabs ul");
</script>
</body>
</html>
Morty Proxy This is a proxified and sanitized view of the page, visit original site.