This was a great episode, you can really see how far the language has come on over the past few years and went through all the things that made working in JS 'icky' and showed a clean modern replacement. Always enjoy Surma and Jake's banter too, really great thing you have got going on here. It reminds me of the UK Top Gear, its really hard to flow from eachother in the way they do.
@dassurma6 жыл бұрын
@MaxArt25016 жыл бұрын
For a complete Top Gear, we need Paul Lewis to join the team.
@pokojduzy52626 жыл бұрын
ok
@vcoppolecchia6 жыл бұрын
"T-Rex mode engaged!" 😂😂😂 Guys have you got any idea of how fantastic this episode is? Thank you!
@PabloGaraguso6 жыл бұрын
Excellent! The showing up of the code with pre/after is great. I liked the "challenge" of figuring out what the code was doing before and after. Thank you guys! Good stuff.
@Slackwise6 жыл бұрын
Regarding destructuring in the function parameters: consider it duck typing documentation. You are declaring what keys you expect an object to contain. You are effectively documenting an interface right on the function that requires it. Given this new perspective, I quite love it.
@carloslfu6 жыл бұрын
A lot of things I used many years ago, I really enjoyed this episode! Good work guys.
@ThadHumphries6 жыл бұрын
Yes, the backslash is needed on the plus sign (@ 9:10)
@jakearchibald6 жыл бұрын
Hah, that's what I get for not-testing.
@MaxArt25016 жыл бұрын
You can omit the backslash if it's inside square brackets. But I bet that /[+]/ is slower than /\+/...
@krystaldick4024 жыл бұрын
@@jakearchibald gftg
@artemeelemann3174 жыл бұрын
Great episode, thank you, guys! By the way. Tag names are written in caps, so it should be li === 'LI'
@BrianBest6 жыл бұрын
Ohhh can we have a dedicated copy button for styles in dev tools?
@_mball_6 жыл бұрын
Prototypical inheritance *is* a class system. Car is a class, and c = new Car() is an instance of a car. ES6 classes don't change that. There's still an object with a prototype, and those methods still exist on that prototype. It's "merely" synaptic sugar. I think it's very useful sugar, but it doesn't actually change the mechanics of classes.
@jakearchibald6 жыл бұрын
Absolutely. The "after" code does roughly the same thing as the "before" code.
@JonathanGray896 жыл бұрын
No, you're wrong. It looks like you began to read knowledgeable information on the subject but somehow completely miscomprehended it. JavaScript does not support classical inheritance, period. It only supports prototypical inheritance. The *syntactic* (not synaptic) sugar only abstracts away the prototypical inheritance model by copying the *syntax* of classical inheritance. That's the reason it's called prototypical inheritance and not classical inheritance.
@AndrewTSq2 жыл бұрын
I liked this episode!. Even if its a bit old today, it still got a few info I did not know :) and I liked the "figure out what the code is doing".
@K3dev6 жыл бұрын
Amazing, you should make a new section for more episodes with this format, not only new vs old, but shortcuts, snipets, tricks, like that blob trick with the response constructor, that was clever!
@KylePolansky6 жыл бұрын
I love these episodes, keep up the great work!
@chethelesser6 жыл бұрын
First example: 5th line - why not just Car.prototype = Object.create(Vehicle.prototype)?
@jakearchibald6 жыл бұрын
Object.create is relatively modern. It certainly wasn't supported when I first did inheritance in JavaScript.
@chethelesser6 жыл бұрын
@@jakearchibald Oh OK, thank you! I'm too young to know :)
@UsmanSubhani20206 жыл бұрын
8:00 what about event.currentTarget 🤔
@jakearchibald6 жыл бұрын
That would be the ul, not the li.
@UsmanSubhani20206 жыл бұрын
@@jakearchibald wow how did i not see that 😃
@vetobadmusic6 жыл бұрын
Is there a reason for the non-oneline solution (Car.prototype = Veichle.prototype) at 2:35? I'm thinking as the prototype still refers to the Veichle prototype in your example. 2:57 also seems a bit odd since it's still all prototypical inheritence under the transpiled hood. Don't get me wrong, I love the new synax sugar. I just find that this video could be a bit confusing for people that think they are "free" from prototypes just because of the new syntax sugar. I also don't think you should dismiss prototypes as being old and qwerky, as they do enable you to do a lot of cool stuff during runtime. This video could probably be more useful if our transpile target was WebAssembly rather than es3/es5.
@runofthemillnpc6 жыл бұрын
Calle Bergström yes. This is because if we were to do what you said, you add anything to Car.prototype, then it also gets added to Vehicle.prototype because both are the same. When you want to extend Car, you don’t want those to also appear in Vehicle.
@JelleDeLoecker5 жыл бұрын
Now you would just do Object.create(Vehicle.prototype) instead of the tmp workaround.
@durchschnittlich6 жыл бұрын
That trick with Response is genius
@emildavidkov16 жыл бұрын
Man this show is awesome, great job, thank you guys :)
@Norsilca4 жыл бұрын
Pretty cool stuff. Maybe some day I'll be able to use it! I tried going full ES6 recently, then discovered one of my main users is still on IE11 often..
@EddyVinck6 жыл бұрын
I love these videos. I have been doing webdev for only a couple of years now and seeing how bad things used to be is very interesting.
@GiovanniOrlandoi76 жыл бұрын
I love this type of episodes
@张四-q9w6 жыл бұрын
Thanks Jake and Surma. Very excited to know about the clean way of the FileReader part. So I have a question about this one: Does Response just apply to readAsArrayBuffer() and readAsText() of FileReader, how about the readAsBinaryString() and readAsDataURL()?
@jakearchibald6 жыл бұрын
Just array buffer really, but once you have the array buffer you can pretty easily convert that to a binary string or data url.
@张四-q9w6 жыл бұрын
@@jakearchibald thanks Jake
@danielmatejka19766 жыл бұрын
I just love your sense of humor ;)
@promatik6 жыл бұрын
Great episode! Thank you guys
@Yamgirly4 жыл бұрын
Who does the captions on these videos, there's a bunch of stuff that's marked as INAUDIBLE that is relatively audible, and would be useful to actually have in the captions for that reason exactly
@bread81766 жыл бұрын
All the tutorials and SO answers showing the old ways haven't gone anywhere... 🙁
@max8hine6 жыл бұрын
does anyone know what's the name of syntax of { duration = 1000 } = {} ??
@Elite75556 жыл бұрын
Destructuring.
@rw77996 жыл бұрын
are making these chats easier to follow or am i getting better at coding ? i understand most of the chat with examples. What you guys think of react?
@jakearchibald6 жыл бұрын
No intentional dumbing down. Although this episode, by definition, concentrates on shipped features whilst we often talk about upcoming or experimental features. In terms of React, Mariko and I talked about squoosh, which we built using Preact kzbin.info/www/bejne/n6GxiGmif62Je9U
@rw77996 жыл бұрын
Ha.. quicker then react!!.. never ending
@Scio_6 жыл бұрын
Surma's reaction was so pure.
@mmahgoub6 жыл бұрын
Why Surma is having a job interview every episode?! This is excruciating!
@jakearchibald6 жыл бұрын
Because I prepare the examples 😀. I'm actually dreading us doing it the other way around, because I don't think I can pick up on code as quickly as he does.
@mmahgoub6 жыл бұрын
@@jakearchibald Surma deserves that compliment 🤗
@rw77996 жыл бұрын
its better now he is a more playing the student ,,he used to double answer before ,which was confusing.. it must take a lot of control as he is obvious genius in this field ....
@AtacamaHumanoid6 жыл бұрын
I feel like he would ace any interview, so it's kind of cool to watch for me.
@yuyokk6 жыл бұрын
like as usual! Thanks, guys 🙏
@paulsammut9996 жыл бұрын
I'll twit at you Jake for the missing animation.finished promise in Chrome, although it was pretty easy just to wrap my animation in a promise and resolve it in onFinish
@nqobastevennovukuza97756 жыл бұрын
@2:08 😂😂😂 "But that's disgusting"
@tankian88296 жыл бұрын
What pad you guys using in the show?
@jakearchibald6 жыл бұрын
It's an old Pixel C. We wanted to use a Pixelbook, but we got weird strobing on the camera that we couldn't get rid of.
@AtacamaHumanoid6 жыл бұрын
All this stuff works in the browser right now?
@AtacamaHumanoid6 жыл бұрын
...all except the last example, it seems. Cool.
@puruvijay61854 жыл бұрын
This episode is historic.
@二宮章子-n7z6 жыл бұрын
What should I do?
@hypersonic126 жыл бұрын
Nice-looking glasses, Surma!
@gigawebsurfer4 жыл бұрын
8:45 should use reduce instead of forEach!
@jakearchibald4 жыл бұрын
absolutely not twitter.com/jaffathecake/status/1213077702300852224?lang=en
@SteveUrlz6 жыл бұрын
That was awesome! Keep it up
@LarsRyeJeppesen6 жыл бұрын
Very informative, Coach
@LOL-hc5fv4 жыл бұрын
TIL about destructuring with default values. Never had to do it but cool that can do.
@maloukemallouke97354 жыл бұрын
I never understood javascript, however, I have not stopped trying.
@danylogudz6 жыл бұрын
looks like there is not only JS here
@bibibobs6 жыл бұрын
I already used the new animations api, it's super sweet for micro animations like clicking a favorite or like button 🔥
@john_p6 жыл бұрын
i just bypassed all that inheritance stuff completely .. never used it, mainly because i never saw an example that demonstrated real world application/benefits ... ill show myself out
@k1ngjulien_6 жыл бұрын
probably since there is rarely a real benefit to inheritance in js. maybe on a gigantic project but in everyday use not really.
@olavgg6 жыл бұрын
I've written an introduction to frontend development with vanilla javascript where I use inheritance to build a form for state management, creating and editing objects. Check it out! github.com/olavgg/vanillajs
@GenghisD0ng6 жыл бұрын
Looking in to SOLID design principles is a good start to see where you could use it. Sometimes its much cleaner and easier to maintain code later on
@ViktorGrandgeorg6 жыл бұрын
As JavaScript's prototype system is at the heart of the language and things like classes, extends and constucors are only syntactic sugar over that in ES6, one could say, that if somebody does not understand the prototype system, he/she does not understand JavaScript at all.
@Elite75556 жыл бұрын
@@ViktorGrandgeorg, that may be true, but what's the point? I take this nice abstraction anytime. Prototype inheritance is just obscure and no other language I know of does it this way and I don't see any benefit.
@NomanHasan096 жыл бұрын
Learned a lot, Thanks.
@petecapecod6 жыл бұрын
Thanks this episode was 🔥🔥 Look we have nice things now 🤔😁👍
@juanluisclaure64856 жыл бұрын
Gracias por tanto, eso fue muy iluminador. Saludos desde Bolivia
@slidewineder39536 жыл бұрын
Thanks bros
@khe_sanh6 жыл бұрын
Damn it even closed captions doesn't catch everything they say
@jakearchibald6 жыл бұрын
Ah sorry. Is there a particular bit that's missing, or is it throughout?
@SashNone6 жыл бұрын
I do not like chrome browser, and I cant even say why.. just so.... but you guys are great :-)
@dikatok6 жыл бұрын
This is why i subscribed
@Textras6 жыл бұрын
I want a square. That's how a human would say that 😂
@AssemblyWizard6 жыл бұрын
I think you forgot: new Array(n+1).join(s) :)
@samirsaeedi746 жыл бұрын
3:08 I'd write it as var duration = options.duration || 1000;
@jakearchibald6 жыл бұрын
That means if the user calls spin({ duration: 0 }) it'll have a duration of one second, which doesn't seem right.
@samirsaeedi746 жыл бұрын
@@jakearchibald Fair enough
@wwhill80336 жыл бұрын
Well done
@omri93256 жыл бұрын
Best episode
@MehmetAliPeker6 жыл бұрын
I need subtitles :/
@jakearchibald6 жыл бұрын
Apologies. All our videos should have subtitles. Not sure what happened here, I'll look into it
@MehmetAliPeker6 жыл бұрын
@@jakearchibald Thanks
@XCSme6 жыл бұрын
I think it's gonna be another 5 years until `el.animate` is well supported, future generations will have to suffer trying to implement programmatic CSS animations. The thing I'm most excited (and will probably be better supported than web animations) is OffscreenCanvas.
@jakearchibald6 жыл бұрын
I'm excited about OffscreenCanvas too. We tried to use it for Squoosh, but we hit a blocking bug bugs.chromium.org/p/chromium/issues/detail?id=906619
@pokojduzy52626 жыл бұрын
ok
@quintinmaseyk69756 жыл бұрын
So good!
@adasjdaksjdlkasldjas5 жыл бұрын
I always though that obscure class inheritance was a JavaScript feature 😜As it made you write more simple and easier to maintain code. eg. not using Classes. To check function parameters/options-paramter you can make use of the truthy/falsy feature of javaScript where any value *except* false, null, undefined, 0, NaN or a empty string - is truthy. Example: var foo = options.foo || default.foo; For the event handler example you can use li.onclick = foo; on all list-elements, this is very powerful as you can make use of closures. Async/await will give you very terse and beautiful small code examples, especially if you ignore all possible errors. But when you need to handle edge cases, errors, and customize - the event emitter pattern is probably more useful. You can still abstract and return a Promise (and callback) for the consumer though. I don't think it's a good idea to add new features that can already be easily implemented and abstracted in user-land. You'll end up in feature-bloat. It's better to focus on features that you *can not* or has performance issues when implemented in existing language spec.
@pablomunoz49956 жыл бұрын
Loved it
@MijeshDeuja6 жыл бұрын
Classes are out now which might make it easier for learning js for students like me who learnt C++ before but University exams are not up to date with current technology.
@masaltascream74846 жыл бұрын
Douglas Crawford called an anonymous function of this kind (function () {}) () dog eggs. I agree with him))
@jimcolabuchanan65796 жыл бұрын
Don't think it is gonna get replaced by web assembly. Too easy to use. Great video guys.
@VitalySergeev6 жыл бұрын
Native typescript support? )))
@naythaniel6 жыл бұрын
You don't know how happy I was when Jake said he designs in devtools and then just copies the stuff back to the editor. OMG! So do I!
@jacksonlenhartmusic6 жыл бұрын
The first example: AAARRRRGHGHGGGHGH MY FUCKING BRAIN!!!! *sees class* ahhhhh, life is good again :) *sips tea*
@an_experienced_guy6 жыл бұрын
You should have just done Car.prototype = new Vehicle();
@jakearchibald6 жыл бұрын
That only works if Vehicle can be called without arguments. In this example it requires an object detailing the number of doors/wheels
@vetobadmusic6 жыл бұрын
That gets clunky as you have to pass the super args again (e.g. Car.prototype = new Vehicle({ doors: doors, wheels: 4 }); . Besides you only want the prototype, not everything defined in that closure. You could oneline this though, just with Car.prototype = Veichle.prototype.
@JelleDeLoecker5 жыл бұрын
You can't just do Car.prototype = Vehicle.prototype, because anything you would add to the car prototype would obviously end up on the Vehicle prototype... Because they're the same thing. Nowadays you would do Car.prototype = Object.create(Vehicle.prototype)
@b3rakesh116 жыл бұрын
Awesome
@iagobruno65396 жыл бұрын
Interesting 😮
@doug22794 жыл бұрын
I hate the new stuff since i felt so good knowing all the old stuff and learning so much only for it all to be rendered useless as the new js any child can code
@simonfarrugia266 жыл бұрын
padding-top: 100% and you get a square.
@jakearchibald6 жыл бұрын
But no space for content
@simonfarrugia266 жыл бұрын
@@jakearchibald position: absolute child. Yes I know it's disgusting.
@bibibobs6 жыл бұрын
@@jakearchibald position absolute ;)
@jakearchibald6 жыл бұрын
Yeah, I use that hack for images, but sometimes it doesn't make sense, or you want to avoid a wrapping element etc etc.
@mrwho25136 жыл бұрын
And that has nothing to do with js, neither DOM APIs
@Berkedavinci6 жыл бұрын
REDUCE THE RAM USAGE I BEG YOU
@janeteorquideascactosesucu83406 жыл бұрын
Olá boa noite! Like
@pokojduzy52626 жыл бұрын
sok
@Oswee6 жыл бұрын
Things will be perfect when gRPC natively will land into Chrome... :)