dorey / javascript-equality-table Goto Github PK
View Code? Open in Web Editor NEWLicense: Creative Commons Attribution Share Alike 4.0 International
License: Creative Commons Attribution Share Alike 4.0 International
hi dorey, take a look at this, the author reordered it so it looks more better.
A string such as " \t \n\n " is falsy and the fact that
" \t \n\n " == false
is true would make a nice addition to the table.
Nice work on this by the way!
What about adding 0
and -0
? It may have some special behavior in JavaScript (see https://twitter.com/creationix/status/449215561147219969).
Both are false, however table shows it true.
I noticed the unified table does not seem to show how IF statements work with the values. Am I just misreading it?
Something that I came up against recently, whitespace compared for equality with 0 resolves to true. It's not the same as an empty string because empty string and white space don't compare equally with empty array for example. So I think white space could legitimately be included in the table.
'\n\t ' == 0
true
'\n\t ' == []
false
'' == []
true
The text above the columns should, in my opinion, no longer be generated with <canvas>
tags. Instead, because CSS has the writing-mode
property, it can be used. If set to vertical-rl
, the text will be still rotated, but also accessible to screen readers.
The red and green used in the tables is not color blind safe. A color blind user can tell that there are two colors being used, but they can not tell which color is red and which color is green.
Object.is ships in some browsers, is part of ES6, and is another way to check for value equality (checks that two values are the same type and same value of that type): https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
I am writing a series of JS books called "You Don't Know JS", here:
https://github.com/getify/You-Dont-Know-JS
The next title, which I'm about to begin, is "Types & Grammar", and I wanted to know if you'd be willing to let me publish (with attribution, of course) an image-form of your chart(s) in the book?
The books are released CC-NC-ND 3.0 (free, non-commercial, non-derivative) online in that repo, and are then being published traditionally (print and ebook form) through O'Reilly.
If so, I'd be grateful, as I think it's a great visualization for the topic. Thanks for your time! :)
'0X0'
'1E0'
1E-1111
['Infinity']
'0X0' : string that is hex for zero if converted to Number
'1E0' : Exponential notation for one if converted to Number
1e-1111 : underflow (zero)
['Infinity'] : ['Infinity'] == Infinity
PS: Thanks for the grid, it is a great reminder of the evils of ==.
PPS: Not to mention 077 versus 088 (ouch - octal!).
PPPS: An == or === symbol inside the green cells of the grids made it clearer to me (using developer toolbar).
The Boolean object seem to get cast when using == but not when using ===.
ex.
new Boolean(true) == true // -> true
new Boolean(true) === true // -> false
new Boolean(false) == false // -> true
new Boolean(false) === false // -> false
NaN == NaN being false is very weird, but at least Infinity == Infinity is true! if()ing Infinity is also true, as is if(-Infinity).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.