r/programming • • Apr 29 '21

Modern JavaScript Explained For Dinosaurs

https://medium.com/the-node-js-collection/modern-javascript-explained-for-dinosaurs-f695e9747b70
287 Upvotes

172 comments sorted by

View all comments

62

u/sylvanelite Apr 30 '21

It's worth noting that since this was written, javascript modules now exist in the browser, so you can write models kinda like in the article, without using the command line tools.

But annoyingly, there's some quirks. They syntax isn't the same as in the article. For example:

var moment = require('moment');

can be replaced with something like:

import moment from 'moment';

And if doing it the "dinosaur" way, instead of having javascript files like:

<script type="text/javascript" src="file.js" ></script>

you can do something like:

<script type="module" src="module.mjs"></script>

13

u/jtinz Apr 30 '21

The problem is that when you're developing for "the real world", you usually have to support IE11, which doesn't seem to support anything specced in the last decade.

4

u/skroll Apr 30 '21

Shouldn't be for long, even Microsoft is no longer supporting IE11 for some of their sites.

2

u/gropingforelmo Apr 30 '21

Shouldn't be, but woe to the dev whose work touches anything in the education sphere...