r/programming • • Oct 03 '16

How it feels to learn Javascript in 2016 [x-post from /r/javascript]

https://medium.com/@jjperezaguinaga/how-it-feels-to-learn-javascript-in-2016-d3a717dd577f#.758uh588b
3.5k Upvotes

852 comments sorted by

View all comments

Show parent comments

7

u/ActualContent Oct 03 '16

How do you debug it? Are there source maps etc? I'm using Typescript and it seems well supported by Chrome Dev tools etc. How does Dart handle this?

3

u/FrozenOx Oct 05 '16

Just test in Dartium. It's a Chromium browser with the Dart VM so it runs the code natively. It's dead easy.

1

u/ActualContent Oct 05 '16

That's awesome, didn't know that existed. Thanks!

1

u/FrozenOx Oct 05 '16

A lot of people troll about Dart, but once you realize you don't have to worry about all the third party libs, task builders, bundlers, modules, test frameworks (it has its own), life is much easier. You can actually be productive and you know...write code instead of obsessing over tools and libraries.

Using third party libs like D3 is still a chore if you need it to be integrated with your Dart code, but you can just use custom events to do simple things like pass some simple data. ALthough there are some big new things coming out like they just moved a new compiler into the official SDK that will eventually output clean JavaScript. And do so incrementally (save file, your JS output updates automatically). When/if that happens, that will be a huge deal.

3

u/leftrightupdown Oct 04 '16

There are 3 ways you can do this.

First is that you use source maps and set breakpoints around like you do in typescript.

Second, download dartium (chrome with dart vm) and setup native breakpoints. When you are satisfied compile to js

Third, connect to observer, native vm profiler that spawns when running native vm code, either via dartium or console. Now, this is really handy when profiling large codebase.

What i do is run dartium during development and set breakpoints there and run observer when optimising. Then when im satisfied compile to js. Many people use their editor (atom or other) to set breakpoints and do debugging in editor but i use emacs so i set breakpoints in dartium.

Also you can compile to js with static type checking as intermediate debugging version, also handy.

If you have any more questions just ask, i can talk about goods and bads of this language, i use it every day in combination with golang and python.