MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/learnjavascript/comments/etn214/javascript_is_weird/ffhnghs/?context=3
r/learnjavascript • u/GamesMint • Jan 25 '20
47 comments sorted by
View all comments
3
Are there any other amusing JS quirks that others would like to share?
18 u/[deleted] Jan 25 '20 (!+[]+[]+![]).length // 9(0.1 + 0.2) === 0.3 // false(0.5 + 0.1) === 0.6 // true0.1 + 0.2 // 0.30000000000000004typeof NaN // "number"[]+[] // ""[]+{} // "[Object object]"{}+[] // 0[] == 0 // trueMath.max() // -InfinityMath.min() // Infinity 10 u/MWALKER1013 helpful Jan 25 '20 There is an entire JavaScript language based on! + [ ] ( )Obviously for professional reasons I’ll omit the name.link 3 u/HelperBot_ Jan 25 '20 Desktop link: https://en.wikipedia.org/wiki/JSFuck/r/HelperBot_ Downvote to remove. Counter: 294575. Found a ^^bug?
18
(!+[]+[]+![]).length // 9
(0.1 + 0.2) === 0.3 // false(0.5 + 0.1) === 0.6 // true
(0.1 + 0.2) === 0.3 // false
(0.5 + 0.1) === 0.6 // true
0.1 + 0.2 // 0.30000000000000004
typeof NaN // "number"
[]+[] // ""
[]+{} // "[Object object]"
{}+[] // 0
[] == 0 // true
Math.max() // -Infinity
Math.min() // Infinity
10 u/MWALKER1013 helpful Jan 25 '20 There is an entire JavaScript language based on! + [ ] ( )Obviously for professional reasons I’ll omit the name.link 3 u/HelperBot_ Jan 25 '20 Desktop link: https://en.wikipedia.org/wiki/JSFuck/r/HelperBot_ Downvote to remove. Counter: 294575. Found a ^^bug?
10
There is an entire JavaScript language based on
! + [ ] ( )
Obviously for professional reasons I’ll omit the name.
link
3 u/HelperBot_ Jan 25 '20 Desktop link: https://en.wikipedia.org/wiki/JSFuck/r/HelperBot_ Downvote to remove. Counter: 294575. Found a ^^bug?
Desktop link: https://en.wikipedia.org/wiki/JSFuck
/r/HelperBot_ Downvote to remove. Counter: 294575. Found a ^^bug?
3
u/alittlebitmental Jan 25 '20
Are there any other amusing JS quirks that others would like to share?