JS  Fundamentals Introduction

JS Fundamentals Introduction

·

2 min read

Welcome to JavaScript Fundamentals

I am so excited to release this content to the world finally. This JS crash course is completely free in an effort to teach thousands of devs the fundamentals of coding via the JavaScript programming language.

What are Programs?

Programs are text files that humans write. They tell computers what to do! Very often, the text we write in programs is called code. People who write programs are referred to as programmers or coders.

Programs are written in a programming language designed to be human-readable. In this way, many programmers can work on the same code with a shared understanding of what it's trying to accomplish!

When a program is ready to be executed by a machine, it is read line by-line by a compiler or an interpreter. Both of these tools will translate the code into instructions a machine can run.

Parsing

Each line in the program is parsed to determine its meaning to the machine. This is done by breaking up each statement into tokens. For instance, we might have a statement:

const a =4

This statement is broken up into the individual tokens: const, a, = and 4

These tokens have a particular meaning to the machine depending on syntax. Programming language defines the syntax. One such programming language is JavaScript. Using JavaScript syntax, the compiler assigns a set of rules to determine the meaning of the above tokens.

It will see the keyword const and know it to be declaring a variable called a. It will recognize = as an assignment operator. Finally, it will determine that 4 is the value to be stored inside of the variable a.

A compiler will read each statement in your program, parsing it. Eventually, it forms a tree-like data structure to represent your program. From this data structure, we will create a series of machine instructions that can be executed directly.

In some languages, compilation creates machine code that is deployed to servers. For JavaScript, compilation happens microseconds before execution. This is referred to as a Just-in-time compilation.

Don't worry if some of that was confusing! it's enough to introduce these concepts for now. We'll dive into further detail in future lessons. We will explore JavaScript syntax one step at a time by writing programs in the coming lessons.