Transitioning to modern JavaScript

  Рет қаралды 88,406

Chrome for Developers

Chrome for Developers

Күн бұрын

Over 90% of web traffic comes from browsers that support modern JavaScript, yet most websites ship legacy syntax in order to support a small number of very old browsers.
We now have the ability to deliver modern and legacy code to browsers based on what they support, but this doesn't extend to the large amount of dependency code in our applications. Our dependencies are still published as verbose legacy syntax in order to support the lowest common denominator of browsers today.
This talk explains how legacy dependency code is one of the biggest performance problems on the web today, and what steps we can all take address it.
Resources:
Publish and ship modern JavaScript → goo.gle/3fD8Tw0
Speakers: Houssein Djirdeh, Jason Miller
Subscribe to Google Chrome Developers here → goo.gle/Chrome...
Watch all Chrome Developer Summit sessions here → goo.gle/cds20-...
#chromedevsummit #chrome #javascript
event: Chrome Dev Summit 2020; re_ty: Publish; product: Chrome - General; fullname: Jason Miller;

Пікірлер: 172
@milanlucansky2825
@milanlucansky2825 3 жыл бұрын
Nice! This video can be also called "The cost of IE11!"
@0dyss3us51
@0dyss3us51 3 жыл бұрын
That was super interesting, would love to see more videos like this
@kolavithonduraski5031
@kolavithonduraski5031 3 жыл бұрын
you are a very good team. good presentation, good talk. nice job guys! Thanks !👍
@nevinkuser9892
@nevinkuser9892 3 жыл бұрын
Yes, well done.
@georgekrax
@georgekrax 3 жыл бұрын
Great talk! Really liked the way you explained things and provided useful and easy solutions
@megabyte01
@megabyte01 3 жыл бұрын
Thank you for this explanation of the benefits of transitioning from es5 to 'modern javascript'. I think I understand why one of my projects ran slower than expected in a certain edge case. I set the target to es5 and it used the transpiled polyfills instead of the modern code.
3 жыл бұрын
I've found generators to be most useful when writing code for Node; in cases where you are slowly going trough a big dataset that mutates during the operation.
@MobiusCoin
@MobiusCoin 3 жыл бұрын
The ONE time I had to use a generator was to do the thing in the example 😅
@hnasr
@hnasr 3 жыл бұрын
Its really weird to hear my name on Google Chrome dev haha Houssein great content and awesome name dude!
@TesterAnimal1
@TesterAnimal1 2 жыл бұрын
Lucky to be able to. I just finished clearing our codebase of IE workarounds and polyfills today.
@vikramadityakukreja6725
@vikramadityakukreja6725 2 жыл бұрын
This was a well presented session. Thanks folks!
@nevinkuser9892
@nevinkuser9892 3 жыл бұрын
I like how you guys casually said to leave anyone who still uses ie11 in the dust. 🤟💪
@tptyuvi
@tptyuvi 3 жыл бұрын
This is really useful 👌 and we will start implementing these modern tranpile which is into ES2017
@truedreams1
@truedreams1 3 жыл бұрын
This video is a nice short way of catching up with status of vanilla JavaScript.
@shaneckel
@shaneckel 3 жыл бұрын
we're boiling the ocean for transpiled js.
@gandautama4141
@gandautama4141 3 жыл бұрын
me too lol... let the transpile do its thing.
@peggyhill8028
@peggyhill8028 3 жыл бұрын
How do you start?
@emr550m
@emr550m 3 жыл бұрын
Love the video guys. Very descriptive and super advanced.
@javiasilis
@javiasilis 3 жыл бұрын
The moment you realized what modern JavaScript is @ 01:50.... my life has never been the same.
@rachitsharma7921
@rachitsharma7921 3 жыл бұрын
The generator part was awesome
@nivo6379
@nivo6379 3 жыл бұрын
Modern for-loops suffer from low performance. The same is true for mixins vs classes. If we want people to adopt new features, we should provide better "runtime-performance" as well. Size != Runtime performance.
@dassurma
@dassurma 3 жыл бұрын
I don't think modern loop constructs are slower anymore. That was true about half a decade ago
@nivo6379
@nivo6379 3 жыл бұрын
@@dassurma I cannot reproduce this in my benchmarks.
@ddrweb_
@ddrweb_ 3 жыл бұрын
What about the bandwidth consumption that this video is generating, how many trees did you plant?
@metzidis
@metzidis 3 жыл бұрын
the modern javascript treadmill : every 2 years rewrite your app in modern javascript. bonus, payload will be 30% larger
@DenisTRUFFAUT
@DenisTRUFFAUT 3 жыл бұрын
7:14 80 petabytes / month of unneeded legacy JavaScript ! 10:45 for await (let v of a)
@jonmongeau5039
@jonmongeau5039 3 жыл бұрын
Quiz at the start had me worried, very informative study.
@ishan101
@ishan101 3 жыл бұрын
This is lovely, great information. Looking fordward for more .
@soykike1991
@soykike1991 3 жыл бұрын
Awesome! will start using estimator on all my projects!
@ThomasGodart
@ThomasGodart 3 жыл бұрын
Excellent video, super clear, super useful. Thanks
@alexleung842
@alexleung842 3 жыл бұрын
Now that Google controls the entire browser market share (Mozilla being killed, Edge & Brave running on Chromium), what's stopping the browser from supporting all the necessary APIs to bring gRPC to browsers natively (ditch the need for gRPC-Web proxies)? The W3C not cooperating?
@Codefide
@Codefide Жыл бұрын
Really great talk, very informative thanks guy. Well, looks like estimator dev got pulled offline real quick though 😢
@serkanyazicioglu
@serkanyazicioglu 3 жыл бұрын
That kitchen is very modern and looks beautiful 👌
@pavel7781
@pavel7781 3 жыл бұрын
What programmes do use to create so excellent presentation? Thank you.
@vivekgautamj
@vivekgautamj 3 жыл бұрын
Clear and concise explanation 👍
@JackSparrah
@JackSparrah 3 жыл бұрын
This was fantastic info. Thank you!!
@tritc
@tritc 3 жыл бұрын
Great! Thank for useful sharing :)
@eneajahollari1203
@eneajahollari1203 3 жыл бұрын
We get this out of the box with #Angular. It's called Differential Loading.
@JasonMillerDeveloper
@JasonMillerDeveloper 3 жыл бұрын
Yep, Angular is doing this nicely too for packages that use the Angular Package Format, since they have an Angular-specific way to publish ES2015. We need that for all the non-Angular modules though (even for ng projects).
@arjunshinde7
@arjunshinde7 3 жыл бұрын
Liked your video very much. Thanks for sharing with us.
@lukor-tech
@lukor-tech 3 жыл бұрын
I am def. Going to show it to my coworkers. Maybe it'll help us a bit.
@semrana1986
@semrana1986 3 жыл бұрын
solid stuff... really enjoyed it... thx
@RodyDavis
@RodyDavis 3 жыл бұрын
Lately I have just been writing everything in typescript. Does this just allow me to target modern and legacy via the typescript compiler?
@jemesmemes9026
@jemesmemes9026 3 жыл бұрын
Yep
@FastLegs
@FastLegs 3 жыл бұрын
Google has some fake-conversation-format in some of these videos and I find it very weird and distracting
@marlonlamancio
@marlonlamancio 3 жыл бұрын
Great and funny class!!
@vikramsrinivasan8176
@vikramsrinivasan8176 3 жыл бұрын
Where do I learn this => when I learned javascript years back it wasn't there?
@Ostap1974
@Ostap1974 3 жыл бұрын
The solution works for now, but would have liked to see a solution that could be also used in 5y. for example or similar, so that every browser could choose the topmost version it knows it supports.
@JasonMillerDeveloper
@JasonMillerDeveloper 3 жыл бұрын
This was proposed a few times and did not move forward. Thankfully, it's very unlikely ES will end up undergoing a transformation on the scale of ES2015 - that spec and the two years that followed it were essentially 10 years of language design rolled into one.
@moonfaceddr
@moonfaceddr 3 жыл бұрын
Very very nice presentation!
@shubitoxX
@shubitoxX 3 жыл бұрын
What about the CSS part? Shipping modern vs legacy CSS?
@dylanadc4403
@dylanadc4403 3 жыл бұрын
Very cool talk thank you!
@sangharshjadhav522
@sangharshjadhav522 3 жыл бұрын
for a person who is on a learning path to web development how would you guide them to learn the modern way of java scripting as their first approach to javascript.
@MrJohn360
@MrJohn360 3 жыл бұрын
Great content, thanks so much for sharing!
@adityapoddar3798
@adityapoddar3798 2 жыл бұрын
After listening to the cost of shipping older version of javascript. In terms of my small contribution towards environment I will try to ship modern javascript. Save Trees.
@jadedtheredone
@jadedtheredone 3 жыл бұрын
Did anyone create a webpack configuration, referencing the last scheme, building both modern and legacy bundles?
@RakeshKumar-bq3mf
@RakeshKumar-bq3mf 3 жыл бұрын
nice info and great job guys...........Thanks...:-)
@kathrinayer6402
@kathrinayer6402 3 жыл бұрын
Is there a link to the data for the carbon cost of old javascript?
@varandpezeshkian6299
@varandpezeshkian6299 3 жыл бұрын
very informative , thank you
@axel_so
@axel_so 3 жыл бұрын
You made me think, great video!
@trappedcat3615
@trappedcat3615 3 жыл бұрын
var and console are actually modern: supported in all modern browsers.
@JasonMillerDeveloper
@JasonMillerDeveloper 3 жыл бұрын
The wording may have been a little off, but the code samples were intended to show examples of syntax that was previously not supported. While ECMA versions are backwards compatible, newly introduced syntax can provide advantages over existing syntax. As an example: `let` bindings can be used within nested scopes, whereas `var` can require a function to achieve the same (same result, just smaller/faster).
@vladmelnyk4329
@vladmelnyk4329 3 жыл бұрын
Lewis must have learnt JS pretty fast
@jamalabdullahi8155
@jamalabdullahi8155 3 жыл бұрын
Hi Hussein GREAT JOB
@avneeshgupta4580
@avneeshgupta4580 3 жыл бұрын
Amazing video ! Very well explained! But I tried the estimator.dev tool it seems broken to me! I see lot of console errors, even when I tried with google.com
@JasonMillerDeveloper
@JasonMillerDeveloper 3 жыл бұрын
Some websites are blocked because of the simple technique I used to block ads/embeds. Google should work but it takes a while. Might have been over the bandwidth limit on the weekend (not sure).
@VitalyZdanevich
@VitalyZdanevich 3 жыл бұрын
Please use dark background for your slides for less CO2.
@peggyhill8028
@peggyhill8028 3 жыл бұрын
Where do you find a Generators to JavaScript
@sudhamajayanthi
@sudhamajayanthi 3 жыл бұрын
As someone with python background and started with JavaScript recently, I HARDLY UNDERSTOOD anything in this, but I felt really something important and interesting to know “what it is” when it is linked with environment...... it would be great if anyone could explain briefly what this video is about?
@adamploof3528
@adamploof3528 3 жыл бұрын
Developing for the web is not my specialty by any means, but I'll take a crack at this question. The main theme of this video is that modern Javascript features are significantly more efficient in terms of the computing power needed to execute Javascript written with those features as well as being generally cleaner to write from the programmer's perspective. The trade off is that not all browsers support these features so you run the risk of your website not functioning properly for a certain segment of users. The typical compromise is to take code written in a modern style and transpile (translate) it into an older syntax of JS that is understandable to browsers that don't support those modern features. The trade off with this approach is that, in return for wider browser support, your program will run slower and be more costly in computing resources to execute. In a nutshell, what the presenters are advocating for is a "have your cake and eat it too" approach. They suggest, when building (compiling) the JS for your application, build a modern version and a legacy version and serve whichever version is most appropriate to the user depending on the browser being used. That way people using modern browsers get the benefits of modern JS, and your application will still work for people on older browsers.
@joshpetit8298
@joshpetit8298 3 жыл бұрын
The moment they brought in the climate statistics I was sold. I'm always reluctant to change but I'm down if it means saving the environment!
@epion33
@epion33 3 жыл бұрын
I thought that segment was un proportionally expressed, considering the rest of the video being all about browser support.
@blehbleheh
@blehbleheh 3 жыл бұрын
Admit it, we all know "cross browser compatibility" was just the politically correct way of saying "make sure it works on Internet Explorer."
@simioni
@simioni 3 жыл бұрын
Microsoft itself has stopped supporting IE. It's no longer installed by default on Windows. It even is redirecting users to Edge automatically now. Why are we even talking about IE at this point?
@liam_iam
@liam_iam 3 жыл бұрын
education and enterprise holding everyone back smh
@JasonMillerDeveloper
@JasonMillerDeveloper 3 жыл бұрын
It's easier to move forward once build systems and the module ecosystem can move beyond catering to the lowest common denominator. This is a distributed problem that requires a distributed solution.
@make-coffee-now
@make-coffee-now 3 жыл бұрын
Murphy’s law: whatever can be coded will eventually be coded in JavaScript
@danieltroger
@danieltroger 3 жыл бұрын
I'd like a guide for parcel to ship untranspiled bundles
@danieltroger
@danieltroger 3 жыл бұрын
btw I figured it out and built a very nice compiling and deployment system
@danieltroger
@danieltroger 3 жыл бұрын
try changing ie11 to "latest 1 firefox version" in this github.com/parcel-bundler/parcel/files/5757137/parcel-bug-repro.zip
@alukart123
@alukart123 3 жыл бұрын
Ok, now why is Object.assign not modern? I only use that in composition based projects, and never had issues. If it's not modern, what else do you use?
@dassurma
@dassurma 3 жыл бұрын
"not modern" doesn't necessarily mean bad. Just means it had support on legacy browsers.
@nguyentonggiang1994
@nguyentonggiang1994 3 жыл бұрын
I think the modern version of Object.assign is spread syntax ( const newObject = {...oldObject}; )
@AzizKhambati
@AzizKhambati 3 жыл бұрын
2:49 That's not binary search but rather depth first search.
@JasonMillerDeveloper
@JasonMillerDeveloper 3 жыл бұрын
Heh - I was waiting for someone to point that out. I wrote the wrong thing in speaker notes and didn't remember to correct it during recording 😂
@phil86_
@phil86_ 3 жыл бұрын
Super super intreresting
@FINSuojeluskunta
@FINSuojeluskunta 3 жыл бұрын
I'm sure this has been asked a million times before but why care about those using IE11 or unsupported browsers? Is it mainly government etc. and they need to be catered to?
@vulgarlang
@vulgarlang 3 жыл бұрын
If you're a big company, like a bank, you don't want to lose that 1% of boomers still using IE11. Interestingly, my bank's website recently announced they are dropping support for IE, which is I think is very bold and commendable of them. Government website's will probably never be able to drop support.
@puk3rz
@puk3rz 3 жыл бұрын
There are many enterprise entities still using ie11, and at much more than 1%. This is of course ignored by people that think web dev is only for public facing websites
@puk3rz
@puk3rz 3 жыл бұрын
Again ignoring enterprise software development, which has a much larger user base still on IE11. (I wish that wasn't the case, but it is)
@MaxMustermann-vu8ir
@MaxMustermann-vu8ir 3 жыл бұрын
Classes: a feature in "modern" JavaScript that "old fashioned" languages such as Java had some 20 years earlier. Funny 😁
@justiceparis7741
@justiceparis7741 3 жыл бұрын
Old JavaScript prototypical inheritance is much easier to understand than "traditional" classes.In some ways it is even better considering single inheritance.
@justiceparis7741
@justiceparis7741 3 жыл бұрын
What if I only know ES5 ? Can I only use ES5?
@NandoSangenetto
@NandoSangenetto 3 жыл бұрын
Nice video!
@AurelioPita
@AurelioPita 3 жыл бұрын
Great stuff
@ahmde
@ahmde 3 жыл бұрын
Me in 2014: I will even support IE 6 Me in 2021: I don't even care about FF
@logusgraphics
@logusgraphics 3 жыл бұрын
Great content
@samiemadfdc
@samiemadfdc 3 жыл бұрын
How is the generator example at [2:49] implementing a lazy "binary search". If I can read it properly it's lazily iterating over all elements. How would it even do a binary search if the dom elements are not sorted?
@AzizKhambati
@AzizKhambati 3 жыл бұрын
Its depth first search.
@samiemadfdc
@samiemadfdc 3 жыл бұрын
@@AzizKhambati Yeah, exactly
@JasonMillerDeveloper
@JasonMillerDeveloper 3 жыл бұрын
heh - yeah, I changed the example but forgot to correct in my speaker notes. Read them out during recording without remembering to correct on the fly.
@samiemadfdc
@samiemadfdc 3 жыл бұрын
@@JasonMillerDeveloper Thanks for the clarification. I was a bit confused because I was really new to the JS generator syntax.
@heinhtetzaw9463
@heinhtetzaw9463 3 жыл бұрын
Save the world by using modern Javascript
@peggyhill8028
@peggyhill8028 3 жыл бұрын
How do you JavaScript
@dachd
@dachd 3 жыл бұрын
as angular Ivy transforms modules to ES2015 and generates Ivy code from ES2015 code, then I don't see a problem that plenty of code is median ES2015. Why not? it's not indicating anything malicious or carelessness.
@JasonMillerDeveloper
@JasonMillerDeveloper 3 жыл бұрын
ES2015 is fairly modern compared to the prevailing default of ES5 used by npm packages. Ivy doesn't generate code from ES2015 though, it generates code from templates. ES2015 is essentially bundled as-authored aside from optimization/minification passes.
@michaelquamdonkor5254
@michaelquamdonkor5254 3 жыл бұрын
Is it relevant to learn jquery now? I wanna learn react or vue
@michaelquamdonkor5254
@michaelquamdonkor5254 3 жыл бұрын
@@claudeb.3473 I already know the basics
@ash-faque
@ash-faque 3 жыл бұрын
We should forget the ie11 :)
@HoffmannPeter
@HoffmannPeter 3 жыл бұрын
Unfortunetly we can't all just forget about ie11. One sad example are schools that still have to deal with old pieces of technology.
@keithnicholas
@keithnicholas 3 жыл бұрын
the irony of legacy software, there's a lot of stuff built for the enterprise that relies on IE11 (things like ActiveX). This software just works, its stood the test of time. Now people want to kill it because they want the latest cool thing :) .... having said that, I want IE11 dead also :)
@Wavywahid
@Wavywahid 3 жыл бұрын
Im so tired of writing or transpiling different code for different browsers. Like I developed web components and for legacy browsers I had to transpile and use polyfills. But IE Edge didn't support it either so I had to transpile and use polyfills for that too. But edge doesn't load scripts when you use 'nomodule'
@JasonMillerDeveloper
@JasonMillerDeveloper 3 жыл бұрын
module/nomodule isn't the best cutoff for Web Components support. For that I'd recommend conditionally loading the polyfill script when `window.customElements` is undefined.
@codeblooded
@codeblooded 3 жыл бұрын
@6:04, the metric should be 780B not 780b
@JasonMillerDeveloper
@JasonMillerDeveloper 3 жыл бұрын
good catch. or 6240b! haha
@kayan_dev
@kayan_dev 3 жыл бұрын
Amazing
@pankajkhushalani
@pankajkhushalani 3 жыл бұрын
I thought you would mention the solution of all this to shift to web assembly language such as Rust😅
@w1d3r75
@w1d3r75 3 жыл бұрын
I didn't know vanilla js was that harmful for the planet :/
@arthurmartincoutrier9586
@arthurmartincoutrier9586 3 жыл бұрын
i learn slowly about you said,sorrry
@martinalcala4823
@martinalcala4823 3 жыл бұрын
Generators are really cool tho
@martinalcala4823
@martinalcala4823 3 жыл бұрын
@@agenticmark btw, Redux Sagas are a great example for using generators in a reactive way
@manantank
@manantank 3 жыл бұрын
Wow 😮
@AlexandrosFotiadis
@AlexandrosFotiadis 3 жыл бұрын
es5, es6, es7, es8, es9, es.. typescript we will get you there if you like it or not 😜
@kathib2571
@kathib2571 3 жыл бұрын
I prefer to not think about energy, that is wasted all the time, frome bitcoin to js, it does not play a role anyway, but thanks^^ for reminding
@cheng6523
@cheng6523 3 жыл бұрын
End of a day: damn... wrote quite a lot CO2-generating JS, probably worth 2 more trees 😂
@ouweiya
@ouweiya 3 жыл бұрын
7:13 Using modern codes can reduce carbon emissions.
@KavehSaket
@KavehSaket 3 жыл бұрын
Thank you. It’s up to us to save the planet
@vikramsrinivasan8176
@vikramsrinivasan8176 3 жыл бұрын
Does browser tightly coupled with Operating System? How difficult is to incorporate JVM into browsers as scaled down java (JavaScript) is supposed to be platform independent?
@samchoi1860
@samchoi1860 3 жыл бұрын
37 million trees!!!!
@webosm6494
@webosm6494 3 жыл бұрын
Really? Cost of legacy Javascripts is measured in CO2 which actually promotes plant and tree growth. Looking back it would have been better to base browser standards when IE 5.5 (50-80% market share) was avaialble and grow from that. It was just hate for MS that got this into this mess in the first place. Box model anyone....
@TrainingWithKona
@TrainingWithKona 3 жыл бұрын
lol why did i not know generators could iterate using for-of
@besrabasant
@besrabasant 3 жыл бұрын
Stop using Javascript.... Reduce CO2 emissions 😂😂😂😂
@FINSuojeluskunta
@FINSuojeluskunta 3 жыл бұрын
This is the only real solution.
@kathib2571
@kathib2571 3 жыл бұрын
and i don´t understand
3x3 SEO tips for JavaScript web apps
12:03
Chrome for Developers
Рет қаралды 23 М.
Does Deno 2 really uncomplicate JavaScript?
8:55
Beyond Fireship
Рет қаралды 369 М.
إخفاء الطعام سرًا تحت الطاولة للتناول لاحقًا 😏🍽️
00:28
حرف إبداعية للمنزل في 5 دقائق
Рет қаралды 81 МЛН
didn't manage to catch the ball #tiktok
00:19
Анастасия Тарасова
Рет қаралды 33 МЛН
Every React Concept Explained in 12 Minutes
11:53
Code Bootcamp
Рет қаралды 720 М.
10 modern layouts in 1 line of CSS
21:39
Chrome for Developers
Рет қаралды 1,1 МЛН
Sign-up form best practices
13:31
Chrome for Developers
Рет қаралды 30 М.
JavaScript Visualized - Event Loop, Web APIs, (Micro)task Queue
12:35
إخفاء الطعام سرًا تحت الطاولة للتناول لاحقًا 😏🍽️
00:28
حرف إبداعية للمنزل في 5 دقائق
Рет қаралды 81 МЛН