subreddit stringclasses 7
values | author stringlengths 3 20 | id stringlengths 5 7 | content stringlengths 67 30.4k | score int64 0 140k |
|---|---|---|---|---|
loljs | kenman | dk3wwjg | <|soss|><|sot|>Should acronyms be spelled all caps or camel case? XMLHttpRequest: Why not both?<|eot|><|sost|><|eost|><|sor|>[deleted]<|eor|><|sor|>As is HTTP...<|eor|><|sor|>as is REQUEST<|eor|><|sor|>No? `Request` is literally the word _request_ -- it's not an acronym.<|eor|><|eoss|><|endoftext|> | 11 |
loljs | mort96 | dir5a82 | <|soss|><|sot|>Should acronyms be spelled all caps or camel case? XMLHttpRequest: Why not both?<|eot|><|sost|><|eost|><|sor|>I also haven't really ever seen anyone actually use it for XML, it's mostly used for JSON.<|eor|><|eoss|><|endoftext|> | 6 |
loljs | fact_hunt | 3odiun | <|sols|><|sot|>NodeJS: stripping comments can speed up your code<|eot|><|sol|>https://medium.com/@c2c/nodejs-a-quick-optimization-advice-7353b820c92e<|eol|><|eols|><|endoftext|> | 34 |
loljs | Vortico | cvwaios | <|sols|><|sot|>NodeJS: stripping comments can speed up your code<|eot|><|sol|>https://medium.com/@c2c/nodejs-a-quick-optimization-advice-7353b820c92e<|eol|><|sor|>Also switching to tab-indention or fewer-spaces indention would do it.<|eor|><|eols|><|endoftext|> | 6 |
loljs | TheShyro | 8n13p3 | <|sols|><|sot|>NPM stops working with proxies, returns "418 I'm a teapot"<|eot|><|sol|>https://github.com/npm/npm/issues/20791<|eol|><|eols|><|endoftext|> | 29 |
loljs | SpoliatorX | dztc8k7 | <|sols|><|sot|>NPM stops working with proxies, returns "418 I'm a teapot"<|eot|><|sol|>https://github.com/npm/npm/issues/20791<|eol|><|sor|>While that *is* a valid HTTP status code I feel like it's probably not correct for them to use it here<|eor|><|eols|><|endoftext|> | 9 |
loljs | CyberDiablo | d3jc46 | <|sols|><|sot|>Why ['1', '7', '11'].map(parseInt) returns [1, NaN, 3] in Javascript<|eot|><|sol|>https://medium.com/dailyjs/parseint-mystery-7c4368ef7b21<|eol|><|eols|><|endoftext|> | 24 |
loljs | WASDx | 3k89jb | <|sols|><|sot|>Doing a javascript online test, this was probably the hardest question.<|eot|><|sol|>http://i.imgur.com/aXNeZ76.png<|eol|><|eols|><|endoftext|> | 26 |
loljs | opatut | cuvt1j5 | <|sols|><|sot|>Doing a javascript online test, this was probably the hardest question.<|eot|><|sol|>http://i.imgur.com/aXNeZ76.png<|eol|><|sor|>Answer: [Hover for Spoiler](/s "C, D, E should not be left blank") <|eor|><|eols|><|endoftext|> | 5 |
loljs | hhalahh | 46fy4y | <|sols|><|sot|>reducing comment length (and presumably variable length) gives 50% speedup<|eot|><|sol|>https://top.fse.guru/nodejs-a-quick-optimization-advice-7353b820c92e<|eol|><|eols|><|endoftext|> | 25 |
loljs | hhalahh | d05f579 | <|sols|><|sot|>reducing comment length (and presumably variable length) gives 50% speedup<|eot|><|sol|>https://top.fse.guru/nodejs-a-quick-optimization-advice-7353b820c92e<|eol|><|sor|>There is a reason for the 600 char limit though.
It is not like it is a magic gain.
The 600 char limit exists to decide whether a fun... | 9 |
loljs | esquilax | d060bjr | <|sols|><|sot|>reducing comment length (and presumably variable length) gives 50% speedup<|eot|><|sol|>https://top.fse.guru/nodejs-a-quick-optimization-advice-7353b820c92e<|eol|><|sor|>There is a reason for the 600 char limit though.
It is not like it is a magic gain.
The 600 char limit exists to decide whether a fun... | 7 |
loljs | esquilax | d05sl70 | <|sols|><|sot|>reducing comment length (and presumably variable length) gives 50% speedup<|eot|><|sol|>https://top.fse.guru/nodejs-a-quick-optimization-advice-7353b820c92e<|eol|><|sor|>There is a reason for the 600 char limit though.
It is not like it is a magic gain.
The 600 char limit exists to decide whether a fun... | 6 |
loljs | esquilax | d0xcil7 | <|sols|><|sot|>reducing comment length (and presumably variable length) gives 50% speedup<|eot|><|sol|>https://top.fse.guru/nodejs-a-quick-optimization-advice-7353b820c92e<|eol|><|sor|>There is a reason for the 600 char limit though.
It is not like it is a magic gain.
The 600 char limit exists to decide whether a fun... | 5 |
loljs | OdinCasino | n25c8n | <|soss|><|sot|>(new Date()).getYear() === 121<|eot|><|sost|><|eost|><|eoss|><|endoftext|> | 21 |
loljs | Earhacker | gwhcrto | <|soss|><|sot|>(new Date()).getYear() === 121<|eot|><|sost|><|eost|><|sor|>JavaScript, invented in 1995, isn't Y2K compliant.<|eor|><|eoss|><|endoftext|> | 11 |
loljs | jordan314 | gwhokub | <|soss|><|sot|>(new Date()).getYear() === 121<|eot|><|sost|><|eost|><|sor|>JavaScript, invented in 1995, isn't Y2K compliant.<|eor|><|sor|>They couldn't think 5 years ahead?<|eor|><|eoss|><|endoftext|> | 9 |
loljs | OdinCasino | gwi6r9m | <|soss|><|sot|>(new Date()).getYear() === 121<|eot|><|sost|><|eost|><|sor|>JavaScript, invented in 1995, isn't Y2K compliant.<|eor|><|sor|>They couldn't think 5 years ahead?<|eor|><|soopr|>This is when boomers where in their 30's writing stuff... of course they didnt think 5 years ahead.
i wonder what the origin of "w... | 8 |
loljs | Aphix | gwjl50s | <|soss|><|sot|>(new Date()).getYear() === 121<|eot|><|sost|><|eost|><|sor|>.getFullYear()<|eor|><|eoss|><|endoftext|> | 7 |
loljs | Aphix | gwjlcjf | <|soss|><|sot|>(new Date()).getYear() === 121<|eot|><|sost|><|eost|><|sor|>wtf happened 121 years ago?<|eor|><|sor|>1900, which was considered bt some to be a better start of the epoch than 1970<|eor|><|eoss|><|endoftext|> | 6 |
loljs | JayCroghan | gwieqny | <|soss|><|sot|>(new Date()).getYear() === 121<|eot|><|sost|><|eost|><|sor|>JavaScript, invented in 1995, isn't Y2K compliant.<|eor|><|sor|>They couldn't think 5 years ahead?<|eor|><|sor|>lol most software written in the 90s was thought to be temporary.
>Surely someone will do this better shorty, I just need this for t... | 6 |
loljs | Krenair | gwj958s | <|soss|><|sot|>(new Date()).getYear() === 121<|eot|><|sost|><|eost|><|sor|>wtf happened 121 years ago?<|eor|><|sor|>nothing, it just isn't Y2K compliant. it used to be very common to give years relative to 1900. caused a whole lot of silliness around the turn of the century<|eor|><|eoss|><|endoftext|> | 5 |
loljs | ThisIsADogHello | 4p286n | <|sols|><|sot|>If the first argument to `setTimeout` is a string, it will be implicitly `eval`'ed [x-post /r/ProgrammerTIL]<|eot|><|sol|>https://www.reddit.com/r/ProgrammerTIL/comments/4oxr7b/javascript_if_the_first_argument_to_settimeout_is/<|eol|><|eols|><|endoftext|> | 24 |
loljs | sheldonkreger | 474sd6 | <|sols|><|sot|>The Node.js Event Loop is a Damn Mess<|eot|><|sol|>http://sheldonkreger.com/the-nodejs-event-loop-is-a-damn-mess.html<|eol|><|eols|><|endoftext|> | 19 |
loljs | loljs | 2elo78 | <|sols|><|sot|>Node.js leadership<|eot|><|sol|>http://i.imgur.com/AZJti8I.png<|eol|><|eols|><|endoftext|> | 20 |
loljs | Harkins | ckwpz4b | <|sols|><|sot|>Node.js leadership<|eot|><|sol|>http://i.imgur.com/AZJti8I.png<|eol|><|sor|>This is missing a tweet from @izs, which I think goes right above (and thus temporally after) @garybernhardts's "This toot makes me mad."
> @garybernhardt Sounds like you have feelings. You should seek a therapist, or a close fr... | 10 |
loljs | dry_hopped | ckws3c4 | <|sols|><|sot|>Node.js leadership<|eot|><|sol|>http://i.imgur.com/AZJti8I.png<|eol|><|sor|>What a waste of everybody's time an attention.<|eor|><|eols|><|endoftext|> | 9 |
loljs | kmark937 | ck9nbkb | <|sols|><|sot|>Node.js leadership<|eot|><|sol|>http://i.imgur.com/AZJti8I.png<|eol|><|sor|>>Thanks, blocked
8 tweets after "Sorry, our time is up."<|eor|><|eols|><|endoftext|> | 8 |
loljs | pcopley | cmm9sa1 | <|sols|><|sot|>Node.js leadership<|eot|><|sol|>http://i.imgur.com/AZJti8I.png<|eol|><|sor|>I know this is 3 months old, but I just felt the need to come here and state that @izs is a piece of shit.
Thank you for your time.<|eor|><|eols|><|endoftext|> | 5 |
loljs | Takeoded | npspu3 | <|soss|><|sot|>NaN is iterable<|eot|><|sost|>```
> Array.from(undefined)
< VM528:1 Uncaught TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
at Function.from (<anonymous>)
at <anonymous>:1:7
(anonymous) @ VM528:1
> Array.from(null)
< VM596:1 Uncaught TypeError: object null i... | 17 |
loljs | Apollidore | h07akex | <|soss|><|sot|>NaN is iterable<|eot|><|sost|>```
> Array.from(undefined)
< VM528:1 Uncaught TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
at Function.from (<anonymous>)
at <anonymous>:1:7
(anonymous) @ VM528:1
> Array.from(null)
< VM596:1 Uncaught TypeError: object null i... | 8 |
loljs | g00glen00b | 3clv62 | <|soss|><|sot|>Who was first, the function or the object?<|eot|><|sost|> Object instanceof Function; // true
Function instanceof Object; // true
Looks like a chicken/egg problem to me, which one was first, the `Object` or the `Function`?<|eost|><|eoss|><|endoftext|> | 18 |
loljs | krznpsk | cswruoy | <|soss|><|sot|>Who was first, the function or the object?<|eot|><|sost|> Object instanceof Function; // true
Function instanceof Object; // true
Looks like a chicken/egg problem to me, which one was first, the `Object` or the `Function`?<|eost|><|sor|>Both the chicken and the egg share a common ancestor<|eor|><... | 9 |
loljs | Takeoded | vl77n1 | <|sols|><|sot|>Number properties are silently lost/discarded/undefined<|eot|><|sol|>https://i.redd.it/efcf4li0iz791.png<|eol|><|eols|><|endoftext|> | 17 |
loljs | Takeoded | idtdvno | <|sols|><|sot|>Number properties are silently lost/discarded/undefined<|eot|><|sol|>https://i.redd.it/efcf4li0iz791.png<|eol|><|soopr|>luckily things are better with "use strict":
```
(function(){
"use strict";
let i=5;
i.foo="wut";
})();
```
gives
>Uncaught TypeError: Cannot create property 'foo' on numbe... | 8 |
loljs | Ragnagord | 4fpnkr | <|sols|><|sot|>Why does [5,6,8,7][1,2] = 8 in Javascript?<|eot|><|sol|>http://stackoverflow.com/questions/7421013/why-does-5-6-8-71-2-8-in-javascript<|eol|><|eols|><|endoftext|> | 15 |
loljs | z500 | d2ax4t0 | <|sols|><|sot|>Why does [5,6,8,7][1,2] = 8 in Javascript?<|eot|><|sol|>http://stackoverflow.com/questions/7421013/why-does-5-6-8-71-2-8-in-javascript<|eol|><|sor|>The comma operator is my favorite dirty C trick. It's so obscure, but C-style languages still bring the comma operator with them. Ever initialize more than o... | 8 |
loljs | Laugarhraun | 2m9rp6 | <|sols|><|sot|>Node.js production release ships with no longer supported (by anyone) version of V8<|eot|><|sol|>https://code.google.com/p/v8/issues/detail?id=3692#c6<|eol|><|eols|><|endoftext|> | 16 |
loljs | MazeChaZer | 7g37g2 | <|soss|><|sot|>JSON.stringify(new Set([1, 2, 3])) === '{}'<|eot|><|sost|><|eost|><|eoss|><|endoftext|> | 14 |
loljs | MazeChaZer | dqgd9a3 | <|soss|><|sot|>JSON.stringify(new Set([1, 2, 3])) === '{}'<|eot|><|sost|><|eost|><|sor|>Yes? The argument is not stored as exposed properties on the object. `JSON.stringify`only handles exposed properties.
This'll work just fine:
JSON.stringify(Array.from(new Set([1, 2, 3])))
Although, it changes the contents fo... | 17 |
loljs | suspiciously_calm | dqh6t0d | <|soss|><|sot|>JSON.stringify(new Set([1, 2, 3])) === '{}'<|eot|><|sost|><|eost|><|sor|>Yes? The argument is not stored as exposed properties on the object. `JSON.stringify`only handles exposed properties.
This'll work just fine:
JSON.stringify(Array.from(new Set([1, 2, 3])))
Although, it changes the contents fo... | 17 |
loljs | suspiciously_calm | dqh8fam | <|soss|><|sot|>JSON.stringify(new Set([1, 2, 3])) === '{}'<|eot|><|sost|><|eost|><|sor|>Yes? The argument is not stored as exposed properties on the object. `JSON.stringify`only handles exposed properties.
This'll work just fine:
JSON.stringify(Array.from(new Set([1, 2, 3])))
Although, it changes the contents fo... | 17 |
loljs | kafoso | dqh1nlc | <|soss|><|sot|>JSON.stringify(new Set([1, 2, 3])) === '{}'<|eot|><|sost|><|eost|><|sor|>Yes? The argument is not stored as exposed properties on the object. `JSON.stringify`only handles exposed properties.
This'll work just fine:
JSON.stringify(Array.from(new Set([1, 2, 3])))
Although, it changes the contents fo... | 7 |
loljs | kafoso | dqhx99i | <|soss|><|sot|>JSON.stringify(new Set([1, 2, 3])) === '{}'<|eot|><|sost|><|eost|><|sor|>Yes? The argument is not stored as exposed properties on the object. `JSON.stringify`only handles exposed properties.
This'll work just fine:
JSON.stringify(Array.from(new Set([1, 2, 3])))
Although, it changes the contents fo... | 7 |
loljs | Nwallins | jfjrbo | <|sols|><|sot|>Just wait till you see what it costs to use functional syntax sugar instead of for loops everywhere!<|eot|><|sol|>https://www.reddit.com/r/programming/comments/jf6by8/using_constlet_instead_of_var_can_make_javascript/g9ijb1z/<|eol|><|eols|><|endoftext|> | 14 |
loljs | hurenkind5 | 4itedk | <|sols|><|sot|>What could go wrong?<|eot|><|sol|>https://reaktor.com/blog/node-js-satellite-means-anyone-can-space-programmer/<|eol|><|eols|><|endoftext|> | 14 |
loljs | Michal_Perlakowski | 6c6b5p | <|sols|><|sot|>Spread operator magically turns functions into 'not functions'<|eot|><|sol|>http://stackoverflow.com/q/44071673/3853934<|eol|><|eols|><|endoftext|> | 13 |
loljs | mort96 | dhsbiyx | <|sols|><|sot|>Spread operator magically turns functions into 'not functions'<|eot|><|sol|>http://stackoverflow.com/q/44071673/3853934<|eol|><|sor|>The problem here seems to be that the double function returns a number, and he's trying to apply the spread operator to the result of calling the function. The spread opera... | 5 |
loljs | MazeChaZer | 573r25 | <|sols|><|sot|>npm can't into sensible lock file handling and --save by default, now Facebook rewrites the whole thing from scratch<|eot|><|sol|>https://code.facebook.com/posts/1840075619545360/yarn-a-new-package-manager-for-javascript/<|eol|><|eols|><|endoftext|> | 13 |
loljs | mort96 | d8pfhil | <|sols|><|sot|>npm can't into sensible lock file handling and --save by default, now Facebook rewrites the whole thing from scratch<|eot|><|sol|>https://code.facebook.com/posts/1840075619545360/yarn-a-new-package-manager-for-javascript/<|eol|><|sor|>So why does Facebook have to check in node_modules into the repo? It s... | 5 |
loljs | getlaidanddie | 37gder | <|soss|><|sot|>var a = Object.create(null)<|eot|><|sost|> typeof a // --> "object"
a instanceof Object // --> false<|eost|><|eoss|><|endoftext|> | 13 |
loljs | 00Davo | ctwemd5 | <|soss|><|sot|>var a = Object.create(null)<|eot|><|sost|> typeof a // --> "object"
a instanceof Object // --> false<|eost|><|sor|>This is totally unsurprising behaviour? `Object.create(null)` produces a new object which doesn't extend from anything, whereas `{}` produces a new object that extends from `Object`. ... | 5 |
loljs | xiata | 75rolf | <|sols|><|sot|>Chrome: Array.prototype.sort() uses an unstable sort algorithm unlike Edge, Firefox, or Safari<|eot|><|sol|>https://jsfiddle.net/L2r2dLek/3/<|eol|><|eols|><|endoftext|> | 12 |
loljs | Silly-Freak | dmv0u9 | <|sols|><|sot|>async/await is new, why give it PHP-style coercion semantics?<|eot|><|sol|>https://i.redd.it/tchk2xoqonu31.jpg<|eol|><|eols|><|endoftext|> | 12 |
loljs | throbbaway | ctyrur | <|soss|><|sot|>I've been trying to become acquainted with "modern" JS today...<|eot|><|sost|>Did you know these three functions do 3 distinct things?
​
let changeName1 = newName => (
{
name: newName
}
)
let changeName2 = newName => {
{
name: newName
}
... | 10 |
loljs | 1kGarand | 22qodc | <|soss|><|sot|>++[[]][+[]]+[+[]] === "10"<|eot|><|sost|>from a reddit comment. I wish I could find it again for proper credit.<|eost|><|eoss|><|endoftext|> | 13 |
loljs | Takeoded | qn8fhu | <|soss|><|sot|>ele.children.length=0 , ele.firstChild = Text node<|eot|><|sost|>running this on reddit,
ele=document.getElementsByTagName("span")[0];
ele.children; // empty HTMLCollection[]
ele.children.length; // 0
it evidently has no children, ok.. quoting [mdn on firstChild](https://developer.mozilla.o... | 10 |
loljs | SoInsightful | hjioyzx | <|soss|><|sot|>ele.children.length=0 , ele.firstChild = Text node<|eot|><|sost|>running this on reddit,
ele=document.getElementsByTagName("span")[0];
ele.children; // empty HTMLCollection[]
ele.children.length; // 0
it evidently has no children, ok.. quoting [mdn on firstChild](https://developer.mozilla.o... | 5 |
loljs | SSPmrsomebody1 | 8lhzyk | <|soss|><|sot|>[]==[] and []===[] return false.<|eot|><|sost|>...Also when I concantenate these two HTMLCollections their "length" value is iterated through so I get a TypeError when my iteration tries to treat the length integer like an HTML element. I thought programming/scripting languages were supposed to be logica... | 10 |
loljs | Nulagrithom | dzgam7q | <|soss|><|sot|>[]==[] and []===[] return false.<|eot|><|sost|>...Also when I concantenate these two HTMLCollections their "length" value is iterated through so I get a TypeError when my iteration tries to treat the length integer like an HTML element. I thought programming/scripting languages were supposed to be logica... | 19 |
loljs | Earhacker | dzh1gzt | <|soss|><|sot|>[]==[] and []===[] return false.<|eot|><|sost|>...Also when I concantenate these two HTMLCollections their "length" value is iterated through so I get a TypeError when my iteration tries to treat the length integer like an HTML element. I thought programming/scripting languages were supposed to be logica... | 13 |
loljs | Pstuc002 | dzftjna | <|soss|><|sot|>[]==[] and []===[] return false.<|eot|><|sost|>...Also when I concantenate these two HTMLCollections their "length" value is iterated through so I get a TypeError when my iteration tries to treat the length integer like an HTML element. I thought programming/scripting languages were supposed to be logica... | 9 |
loljs | Kazumz | dzhpn91 | <|soss|><|sot|>[]==[] and []===[] return false.<|eot|><|sost|>...Also when I concantenate these two HTMLCollections their "length" value is iterated through so I get a TypeError when my iteration tries to treat the length integer like an HTML element. I thought programming/scripting languages were supposed to be logica... | 5 |
loljs | Nulagrithom | dzha1gu | <|soss|><|sot|>[]==[] and []===[] return false.<|eot|><|sost|>...Also when I concantenate these two HTMLCollections their "length" value is iterated through so I get a TypeError when my iteration tries to treat the length integer like an HTML element. I thought programming/scripting languages were supposed to be logica... | 5 |
loljs | Earhacker | dzhoo3p | <|soss|><|sot|>[]==[] and []===[] return false.<|eot|><|sost|>...Also when I concantenate these two HTMLCollections their "length" value is iterated through so I get a TypeError when my iteration tries to treat the length integer like an HTML element. I thought programming/scripting languages were supposed to be logica... | 5 |
loljs | lhgaghl | 1xoenm | <|sols|><|sot|>JSt world problems<|eot|><|sol|>http://fifod.com/why-you-should-always-use-and-other-bad-practices/<|eol|><|eols|><|endoftext|> | 9 |
loljs | 1114111 | 71859r | <|soss|><|sot|>Array.from({lol: "js"}) returns empty array<|eot|><|sost|>Converting non-iterable objects (or numbers) to arrays using `Array.from` silently returns an empty array. That is, of course, unless you pass something like undefined or null. Then you get the descriptive error `TypeError: V is null` (Firefox, ... | 9 |
loljs | samdroid_ | 697ctq | <|sols|><|sot|>Arithmetic with JavaScript Arrays<|eot|><|sol|>https://learntemail.sam.today/blog/arithmetic-with-javascript-arrays/<|eol|><|eols|><|endoftext|> | 10 |
loljs | BillOReillyYUPokeMe | 4ipm6b | <|soss|><|sot|>~!!"0"[+'hello']+'2.99';<|eot|><|sost|>> "-12.99"
What the fuck?<|eost|><|eoss|><|endoftext|> | 11 |
loljs | eof | 1pln77 | <|soss|><|sot|>javascript sorts arrays lexographically by default<|eot|><|sost|> >a = [1.2, 8.8, 11.4]
[1.2, 8.8, 11.4]
>a.sort()
[1.2, 11.4, 8.8]
<|eost|><|eoss|><|endoftext|> | 9 |
loljs | Takeoded | eebe2l | <|soss|><|sot|>decodeURIComponent()<|eot|><|sost|> > decodeURIComponent()
< "undefined"
yup, the decoded version of absolutely nothing is string literal `"undefined"`
for comparison, here's what PHP does:
$ php -r 'var_dump(urldecode());'
PHP Warning: urldecode() expects exactly 1 parameter, 0 ... | 8 |
loljs | the_alias_of_andrea | fbt17m4 | <|soss|><|sot|>decodeURIComponent()<|eot|><|sost|> > decodeURIComponent()
< "undefined"
yup, the decoded version of absolutely nothing is string literal `"undefined"`
for comparison, here's what PHP does:
$ php -r 'var_dump(urldecode());'
PHP Warning: urldecode() expects exactly 1 parameter, 0 ... | 5 |
loljs | jonnyburger | 5pxikb | <|soss|><|sot|>let r = /abc/g; console.log(r.test('abc'), r.test('abc')); // true false<|eot|><|sost|> const REGEX = /abc/g
REGEX.test('abc');
> true
REGEX.test('abc'));
> false
<|eost|><|eoss|><|endoftext|> | 8 |
loljs | z500 | dcum15j | <|soss|><|sot|>let r = /abc/g; console.log(r.test('abc'), r.test('abc')); // true false<|eot|><|sost|> const REGEX = /abc/g
REGEX.test('abc');
> true
REGEX.test('abc'));
> false
<|eost|><|sor|>The first call to `test` advances `REGEX.lastIndex` to 3, the length of the matched string. The second call... | 13 |
loljs | phvcky | dcvnk7s | <|soss|><|sot|>let r = /abc/g; console.log(r.test('abc'), r.test('abc')); // true false<|eot|><|sost|> const REGEX = /abc/g
REGEX.test('abc');
> true
REGEX.test('abc'));
> false
<|eost|><|sor|>As /u/z500 correctly pointed out, this is intended behavior. Remove the global flag or reset `r.lastIndex =... | 13 |
loljs | sheldonkreger | 3fnshq | <|sols|><|sot|>Node.JS "best practices" . . . or a long list of reasons why JS is poorly suited for async operations?<|eot|><|sol|>http://justbuildsomething.com/node-js-best-practices/<|eol|><|eols|><|endoftext|> | 8 |
loljs | BowserKoopa | ctrcbba | <|sols|><|sot|>Node.JS "best practices" . . . or a long list of reasons why JS is poorly suited for async operations?<|eot|><|sol|>http://justbuildsomething.com/node-js-best-practices/<|eol|><|sor|>Can be replaced with
> 1. Don't write in JavaScript<|eor|><|eols|><|endoftext|> | 10 |
loljs | Banane9 | cw7lgwm | <|sols|><|sot|>Node.JS "best practices" . . . or a long list of reasons why JS is poorly suited for async operations?<|eot|><|sol|>http://justbuildsomething.com/node-js-best-practices/<|eol|><|sor|>> When this happens the server would effectively be inaccessible for 30 minutes as that module is loaded. If this happens ... | 6 |
loljs | monitorius1 | 88dqxh | <|sols|><|sot|>This is from latest is-odd library debate<|eot|><|sol|>http://rextester.com/EYLHR12670<|eol|><|eols|><|endoftext|> | 6 |
loljs | Vortico | dwjwgft | <|sols|><|sot|>This is from latest is-odd library debate<|eot|><|sol|>http://rextester.com/EYLHR12670<|eol|><|sor|>This isn't realy loljs material because it is well-known that the 'number' JS type is an IEEE 754 double.<|eor|><|eols|><|endoftext|> | 11 |
loljs | loljs | 2aztvm | <|sols|><|sot|>JavaScript Jeopardy<|eot|><|sol|>https://twitter.com/jsjeopardy<|eol|><|eols|><|endoftext|> | 7 |
loljs | Takeoded | 68bfi0 | <|soss|><|sot|>big numbers are equal<|eot|><|sost|> >100000000000000000==99999999999999999
<true
the scary part, === doesn't even notice this
>100000000000000000===99999999999999999
<true
and if you try a string:
>100000000000000000=="99999999999999999"
<true
but at least, it notices that... | 4 |
loljs | arilotter | dgx6i1f | <|soss|><|sot|>big numbers are equal<|eot|><|sost|> >100000000000000000==99999999999999999
<true
the scary part, === doesn't even notice this
>100000000000000000===99999999999999999
<true
and if you try a string:
>100000000000000000=="99999999999999999"
<true
but at least, it notices that... | 20 |
loljs | Drainedsoul | dgx93gs | <|soss|><|sot|>big numbers are equal<|eot|><|sost|> >100000000000000000==99999999999999999
<true
the scary part, === doesn't even notice this
>100000000000000000===99999999999999999
<true
and if you try a string:
>100000000000000000=="99999999999999999"
<true
but at least, it notices that... | 20 |
loljs | ConcernedInScythe | dgzr7x0 | <|soss|><|sot|>big numbers are equal<|eot|><|sost|> >100000000000000000==99999999999999999
<true
the scary part, === doesn't even notice this
>100000000000000000===99999999999999999
<true
and if you try a string:
>100000000000000000=="99999999999999999"
<true
but at least, it notices that... | 18 |
loljs | Vortico | dgx9vby | <|soss|><|sot|>big numbers are equal<|eot|><|sost|> >100000000000000000==99999999999999999
<true
the scary part, === doesn't even notice this
>100000000000000000===99999999999999999
<true
and if you try a string:
>100000000000000000=="99999999999999999"
<true
but at least, it notices that... | 9 |
loljs | Vortico | dgx9xry | <|soss|><|sot|>big numbers are equal<|eot|><|sost|> >100000000000000000==99999999999999999
<true
the scary part, === doesn't even notice this
>100000000000000000===99999999999999999
<true
and if you try a string:
>100000000000000000=="99999999999999999"
<true
but at least, it notices that... | 8 |
loljs | Takeoded | dgx6ojd | <|soss|><|sot|>big numbers are equal<|eot|><|sost|> >100000000000000000==99999999999999999
<true
the scary part, === doesn't even notice this
>100000000000000000===99999999999999999
<true
and if you try a string:
>100000000000000000=="99999999999999999"
<true
but at least, it notices that... | 7 |
loljs | Vortico | dgx6q8l | <|soss|><|sot|>big numbers are equal<|eot|><|sost|> >100000000000000000==99999999999999999
<true
the scary part, === doesn't even notice this
>100000000000000000===99999999999999999
<true
and if you try a string:
>100000000000000000=="99999999999999999"
<true
but at least, it notices that... | 6 |
loljs | MarkyC4A | 50usqc | <|sols|><|sot|>Adding an Object in an Object creates a key based on the variable name<|eot|><|sol|>https://jsfiddle.net/ame8g6kv/1/<|eol|><|eols|><|endoftext|> | 5 |
loljs | amirmikhak | d77iybx | <|sols|><|sot|>Adding an Object in an Object creates a key based on the variable name<|eot|><|sol|>https://jsfiddle.net/ame8g6kv/1/<|eol|><|sor|>I'm honestly not sure what you think should happen here... I believe that this is a result of ES6 object shorthand syntax. Without a `:` after each key, the key for that entry... | 7 |
loljs | lukaseder | 2bugrg | <|sols|><|sot|>Defeating infinity: parseInt(1 / 0, 19) == 18<|eot|><|sol|>http://www.ctmmc.net/defeating-infinity<|eol|><|eols|><|endoftext|> | 5 |
loljs | phoborsh | eoaxb9 | <|sols|><|sot|>Does this nightmare of a language always execute things in the wrong order?<|eot|><|sol|>https://i.redd.it/1z1ctphv8ma41.jpg<|eol|><|eols|><|endoftext|> | 4 |
loljs | ipe369 | feb18zk | <|sols|><|sot|>Does this nightmare of a language always execute things in the wrong order?<|eot|><|sol|>https://i.redd.it/1z1ctphv8ma41.jpg<|eol|><|sor|>Does the function have async calls? 'cause that's just a language feature, not just js being dumb
Maybe the problem is you just don't know how to program in the langu... | 11 |
loljs | drumskirun | fecgz5s | <|sols|><|sot|>Does this nightmare of a language always execute things in the wrong order?<|eot|><|sol|>https://i.redd.it/1z1ctphv8ma41.jpg<|eol|><|sor|>First, console.out is not a function, console.log is. If you're this new to the language then you have some reading up to do on the Event Loop.
https://stackoverflow.... | 8 |
loljs | Takeoded | 6mqoh9 | <|sols|><|sot|>What the... JavaScript? - Kyle Simpsons<|eot|><|sol|>https://www.youtube.com/watch?v=2pL28CcEijU<|eol|><|eols|><|endoftext|> | 4 |
loljs | sheldonkreger | 3imwgu | <|sols|><|sot|>Simply trying to figure out the type of a variable returned from an API call. I guess it's really hard.<|eot|><|sol|>http://stackoverflow.com/questions/7390426/better-way-to-get-type-of-a-javascript-variable<|eol|><|eols|><|endoftext|> | 3 |
loljs | Banane9 | 2mlr23 | <|sols|><|sot|>There second argument in substring and substr has different meanings<|eot|><|sol|>http://stackoverflow.com/questions/3745515/what-is-the-difference-between-substr-and-substring<|eol|><|eols|><|endoftext|> | 4 |
loljs | nalldom | 1hqs08 | <|sols|><|sot|>So I was debugging my validation since 4 hours...<|eot|><|sol|>http://stackoverflow.com/questions/894696/why-is-the-javascript-regexp-test-method-behaving-as-a-toggle<|eol|><|eols|><|endoftext|> | 3 |
loljs | lukaseder | 2d4t2u | <|soss|><|sot|>Hold your horses! ['10','10','10','10'].map(parseInt) yields [10, NaN, 2, 3]<|eot|><|sost|><|eost|><|eoss|><|endoftext|> | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.