Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
|
BuzzKilla1960's comments
login
BuzzKilla1960
on Jan 7, 2014
|
parent
|
context
|
next
[–]
| on:
Top 5 MongoDB gotchas
Wouldn't the simpler, faster and more appropriate syntax be
if (N > 50 || N < 1) ??
BerislavLopac
on Jan 8, 2014
|
parent
|
next
[–]
No it wouldn't, because -30 is supposed to work the same as 30, so you want to convert the sign to positive first. Personally, I'd use something like:
if (!N || Math.abs(N) > 50 ) { N = 50 };
imslavko
on Jan 7, 2014
|
parent
|
prev
|
next
[–]
It would be a simpler and shorter piece of code. Not sure why it would be faster though. Anyways, the point was in the behavior of `limit` which is easy to miss.
angersock
on Jan 7, 2014
|
parent
|
prev
|
next
[–]
I think they may be trying something clever with the truthiness of N there...
BuzzKilla1960
on Jan 23, 2013
|
parent
|
context
|
prev
|
next
[–]
| on:
Private keys committed to Github repositories
Finally a github search that works!!!!
BuzzKilla1960
on Nov 13, 2012
|
parent
|
context
|
prev
[–]
| on:
Show HN: Socrates.io - clean and shareable markdow...
api?
webbruce
on Nov 13, 2012
|
parent
[–]
Really great UI design, I love it.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
if (N > 50 || N < 1) ??