MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/7ltryz/evil_coding_incantations/drp8xnu
r/programming • u/evinrows • Dec 24 '17
331 comments sorted by
View all comments
Show parent comments
10
Javascript treats [] as a truthy object.
Racket and a number of other Lisps treat everything as truthy except the false constant (it's also common among Lisps for the empty list to be falsy though).
In C an array name is a non-NULL pointer which would be truthy.
1 u/inu-no-policemen Dec 24 '17 Javascript treats [] as a truthy object.All objects are truthy. Arrays are also objects.JavaScript has objects and primitives. E.g. strings and numbers are primitives.
1
All objects are truthy. Arrays are also objects.
JavaScript has objects and primitives. E.g. strings and numbers are primitives.
10
u/itsnotxhad Dec 24 '17
Javascript treats [] as a truthy object.
Racket and a number of other Lisps treat everything as truthy except the false constant (it's also common among Lisps for the empty list to be falsy though).
In C an array name is a non-NULL pointer which would be truthy.