Twitter | Search | |
T.J. Crowder
My new book "JavaScript: The New Toys" on what's new in JavaScript is out! (he/him)
1,983
Tweets
69
Following
408
Followers
Tweets
T.J. Crowder Sep 10
Replying to @AdamRackis
I'm trying to imagine feeling the need to live in my hatred of someone with such devotion I actually buy something like that, spend time installing it, and then return to my hatred of the people 3-4 times a day thereafter. Unreal. And...ill.
Reply Retweet Like
T.J. Crowder Sep 10
Amusingly, given your display name, if you want something shorter than `undefined`, there's `void 0`: `foo(arg1, void 0, arg2)` A bit obscure, though.
Reply Retweet Like
T.J. Crowder Sep 10
I've had it on my list forever to do a proper proposal for this (spec text, etc.), but I keep not getting to it not least because I keep wanting to contribute to _other_ proposals first, and I keep not having the time. ☹️
Reply Retweet Like
T.J. Crowder Sep 9
Replying to @laurieontech
A way to execute asynchronous operations.
Reply Retweet Like
T.J. Crowder Sep 9
Replying to @tjcrowder
Yes, you're really reading that right. It's a getter for an accessor property that opens a dialog box and fires an async request to the server. (And BTW, the actual function's name doesn't mention the async request, just the dialog.) Where's the "speechless" emoji?
Reply Retweet Like
T.J. Crowder Sep 9
Just found basically this code in a TS class in an npm module we're using: ``` get result(): Promise<string> { if (this._result === null) { this._result = this._openDialogAndQueryServer(); } return this._result; } ``` ...😲? ... 😲? ... 🤯!!
Reply Retweet Like
T.J. Crowder Sep 4
Replying to @malchata
Sorry to hear that, I hope next week is way, way better. (Says random guy you don't know, but who has seen your work in a couple of places and appreciated it.)
Reply Retweet Like
T.J. Crowder Sep 4
Replying to @AdamRackis
Been doing this professionally for 30 years now. Still love it. Still get up excited about solving problems. Still get a rush when something works, even something simple. (To be clear, the above is about coding. All the rest of the stuff that goes with contracting is...meh.)
Reply Retweet Like
T.J. Crowder Sep 3
Replying to @littlecalculist
Big time. And: 2.b. The way she says "Eew-a" and just generally adds a syllable to the ends of sentences. And that thing she does with her hands.😃 Cannot wait to see what Daniel Levy and Annie Murphy each do next.
Reply Retweet Like
T.J. Crowder Sep 2
I can't see why, unless it's slightly slower in the parsing stage. Do you have a benchmark? Without substitutions, and if you're not using a tag function, `foo` and "foo" both parse to strings.
Reply Retweet Like
T.J. Crowder Sep 2
...not worry about whether you're doing that where an expression is expected vs. where a string literal is expected. I've met people who always use ` already...except for when they can't, which causes chafing. 😀
Reply Retweet Like
T.J. Crowder Sep 2
Sure. 😀 But I'm talking about just being able to use a template literal (without substitutions) anywhere you can use a string literal, including a nice static import: import { something } from `somewhere`; // Invalid for now It would allow you to just always use ` and...
Reply Retweet Like
T.J. Crowder retweeted
Jericho Aug 31
Black Mirror really outdid themselves this time. Having us experience season 6 instead of watching it on Netflix. Outstanding. 👏🏾
Reply Retweet Like
T.J. Crowder Sep 1
Replying to @PrasoonPratham
... literals restricted to not having substitutions in places you can currently only use string literal (imports, use strict, ...is there a third place? I have the sense there is...).
Reply Retweet Like
T.J. Crowder Sep 1
Replying to @PrasoonPratham
Just about any time I start out not using a template literal (b/c of old ES5 habits or I thought I was going to have static text), I end up going back and doing a template literal. Very nearly considering always using them, and writing up a proposal for allowing template ...
Reply Retweet Like
T.J. Crowder Aug 28
Replying to @sag1v
Thanks!! Don't know why I didn't search more and find that github thread.
Reply Retweet Like
T.J. Crowder Aug 28
Replying to @tjcrowder
I suppose I could do a useEffect that depends on the state, but it seems fairly verbose, and it would happen on every change to that state member, not just the one I'm interested in waiting for... Feels like I'm missing something obvious. 😟
Reply Retweet Like
T.J. Crowder Aug 28
Okay, peeps -- what's the hooks equivalent to setState's second argument? The state setter from useState doesn't seem to have it. Obviously I know the component/hook function the state is in will get called again, but lots of things could have triggered that.😀 TIA!
Reply Retweet Like
T.J. Crowder Aug 26
(But nothing built-in deals with combining marks, etc.)
Reply Retweet Like
T.J. Crowder Aug 26
^^ Tech twitter needs more posts like this. FWIW, depending on the definition of "character" you want to use in your use case, `[...word1].length` may be more accurate than `word1.length` (or `word1.split("").length`) because it handles surrogate pairs. 🙂
Reply Retweet Like