Skip to content

Instantly share code, notes, and snippets.

@threepointone
Last active July 31, 2022 17:46
Show Gist options
  • Save threepointone/75eadefb56c448c9df4cb41b75fd42c2 to your computer and use it in GitHub Desktop.
Save threepointone/75eadefb56c448c9df4cb41b75fd42c2 to your computer and use it in GitHub Desktop.
list of things that don't do what they say they do

(also know as lies and/or alternative facts)

js

  • setImmediate - doesn't set anything immediately, waits for a tick before executing
  • setTimeout(fn, n) - never sets the timeout to exactly n
  • Math.random() - computers cannot generate random numbers
  • Promise - is a lie when rejected
  • Array.reduce - accumulates, does not reduce (via @sbmadhav)
  • const - isn't constant, can be mutated (via adamwknox)
  • typeof NaN === 'number' 🙄 (via @delapouite)
  • continue - stops execution of current block (via @vdanchenkov)

react

  • setState - doesn't set, but enqueues a state change
  • createElement - creates a description of the actual element
  • instance::render() - doesn't actually render
  • componentWillMount - component might not mount
  • react (!) - doesn't react immediately, schedules changes instead

misc

  • babel - speaks only one language (though understands many)
  • rxjs - rx implies prescription, not subscription
  • javascript - isn't a scripting language for java, or related to java in any way.
  • isomorphic - is a word used to compare two different, but similar structures; not to say that one structure works in multiple places (via @gaearon)
@josieusa
Copy link

yarn upgrade [package@version] downgrades, does not upgrade if the specified version is older than the one installed

@GtAntoine
Copy link

JavaScript getDate() Method that return the day of the month and not the actual date

@thetrompf
Copy link

Don't you think rx in rxjs comes from rx/tx that means receive/transmit, then the rx part make sense?

@ketralnis
Copy link

Responsive: JS uses it to mean dynamically resizeable rather that the usual meaning of UI performance

@clarkenciel
Copy link

but reduce does, generally, reduce many values into a single value. that reduction might be through accumulation, but it's still many -> one.

@jasonkarns
Copy link

jasonkarns commented Jan 26, 2017

Const isn't a lie. It's a constant reference. The binding doesn't change. The keyword isn't "immut", so expecting immutibility is false equivalence

@sonhanguyen
Copy link

createElement() does create element, which is the description of a react component instance. I guess they can rename it to createReactElement (as different from DOMElement).

@dtipson
Copy link

dtipson commented Jan 27, 2017

NaN is rightly a number. It's Not a Not a Number!

@yosun
Copy link

yosun commented Jan 27, 2017

this should be made a wiki somewhere so people can add stuff from other languages

@jorgebucaran
Copy link

this should be made a wiki somewhere so people can add stuff from other languages

Great idea.

@jaredly
Copy link

jaredly commented May 25, 2017

lol lots of people want to fight in these comments. this is a fun list of things that can be pretty suprising

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment