3 Minutes with Kent

Use ASTExplorer.net to deepen your understanding of JavaScript

01.19.2021 - By Kent C. DoddsPlay

Download our free app to listen on your phone

Download on the App StoreGet it on Google Play

Hi there friends So today, I wanted to talk about understanding the syntax

of JavaScript. Now, I most of us when we're learning JavaScript, we are

introduced to each part of syntax and some of its capabilities and we just

kind of learn about that syntax through experience of working with it and

there's nothing wrong with that approach that's pretty like the the best

way to learn anything is really just practical application.

But there are often things that you skip over when you just focus on

practical application ofThe of knowledge And especially if JavaScript is

the first language that you learn maybe because it does borrow syntax from

other languages. Maybe there are things that you just don't know are

possible or don't really have a good good grasp on because you don't

understand the fundamentals of that syntax in particular.

So what I'm going to suggest to you is that anytime you see some syntax

that you're not super familiar with or you think it's one way but things

aren't working the way that you expect or something like that. Anytime you

see something syntax? I want you to copy that code.

Into a tool called AST Explorer dot net. It's AST is an acronym for

abstract syntax trees, which does sound pretty complicated but I promise

you that it's nothing magic. It's something that you can learn but go to

AST explorer.net paste in the code on the editor on the left and on the

right side, you're going to see a representation of that code in what's

called an abstract syntax tree.

You can represent it as like an JSON object or something. And each element

of syntax.Has a particular node name and a type and as you click around you

should be able to see the name of the AST node for the part of the code

that you're looking at.

And so AST Explorer can be a really great way for you to get an

understanding of what the different parts of the code represent for the

computer and it can also help you get an idea of like, oh this is called an

import specifier, but then when I do this with an object that's called an

object pattern.

So, maybe those two things like the structuring and imports are not the

same.Thing which they aren't So you can go ahead and try some of that. And

you'll get a little deeper understanding. The other nice thing about this

is that it makes those things Googleable. So instead of saying, hey what's

that thing at the import statement or whatever.

You can say I want to learn about import specifiers and then you can Google

around about that. So, hopefully that's helpful to use kind of interesting

to play around with AST explorer.net. I wish you the best of luck and I

hope you have a stellar day and we'll see you in the future.

More episodes from 3 Minutes with Kent