LEARNING THE FUNDAMENTAL
JavaScript Fundamentals: Understanding Syntax, Basic Constructs, and Fundamental Concepts
Frontend Roadmap: Javascript Part I
Ok! So you’ve decided to learn Javascript from scratch or re-learn Javascript Fundamentals.
JavaScript is a versatile language that empowers developers to create interactive and dynamic websites. Whether you’re working on the front-end or back-end, JavaScript has got you covered.
In this article, we’ll dive into the basics of JavaScript and explore its high-level nature, the significance of ECMAScript, and some essential syntax and constructs. By the end, you’ll have a solid foundation to start building your own JavaScript-powered applications. Let’s get started!
What is Javascript?
JavaScript is a programming language that allows you to add interactivity and dynamic behavior to websites. It is primarily used for front-end web development but can also be used on the back end with frameworks like Node.js.
JavaScript is a high-level, interpreted language, which means it is executed directly by the browser without compilation.
But what does this mean?
Well, the meaning that Javascript is a High-level Language is that it provides a higher level of abstraction, making it easier for developers to write code compared to low-level languages like assembly or machine code. Basically that Javascript was designed to be easy for humans to read, write, and understand. So you can focus more on the logic and functionality of your code rather than getting caught up in complex technical details. You can write JavaScript code that tells the browser what to do, such as displaying information, handling user interactions, or making things happen on a web page.
And what is ECMAScript?
Now, you may have heard about ECMAScript. This is the official standard that defines the syntax, behavior, and features of the JavaScript programming language. It provides guidelines on how JavaScript should work, ensuring consistency across different implementations and enabling developers to write code that works across different platforms and browsers.
The ECMAScript standard is maintained by the ECMA International organization, a standard organization for information and communication systems. They regularly update and release new versions of the ECMAScript specification to introduce new features, improve the language, and address any issues or inconsistencies.
Each new version of ECMAScript introduces new features, syntax, and improvements to JavaScript. For example, ECMAScript 6 (ES6), also known as ECMAScript 2015, introduced significant additions to the language, including arrow functions, template literals, classes, and enhanced syntax for working with arrays and objects.
JavaScript follows a syntax similar to other programming languages. In the following lines, you will find a summary of some basic constructs and syntax used in JavaScript.
P.S. Almost all my sources for learning JavaScript come from two of the most reliable websites. I will provide the sources at the end of each section so that you can check and learn more deeply on your own.
Statements
JavaScript code is composed of statements, which are instructions that perform actions. Each statement typically ends with a semicolon (;), but this is optional.
console.log("Hello, World!"); // Outputs "Hello, World!" to the console
Comments
Comments are used to add explanatory notes to the code and are ignored by the JavaScript engine. There are two types of comments in JavaScript: single-line comments and multi-line comments.
// This is a single-line comment
/*
This is a multi-line comment.
It can span multiple lines.
*/
Variables
Variables are used to store and manipulate data in JavaScript. You can declare variables using the var
, let
, or const
keywords.
var name = "John"; // old way to declare a variable / not recommended
let age = 25; // modern way to declare a variable that can change
const PI = 3.14; // declare a variable that is unchangeable, a constant
But! Since ECMAScript 6, the declaration of variables using var
has become almost obsolete due to the potential issues it could cause in a project.
Technical questions
What is a High-Level Language?
High-level languages, such as JavaScript, are the type of language that provides a higher level of abstraction and are designed to be easier for humans to read, write, and understand.
What does ES6 stand for in JavaScript, and what is it?
ES6 stands for ECMAScript 6, also known as ECMAScript 2015. It is a major update to the JavaScript language specification. ES6 introduced significant additions and improvements to JavaScript, including new syntax, features, and functionality.
P.S. If you are a native Spanish speaker or learning this beautiful language, you can check out the twin post that will be in Spanish. The same concept and explanations but in another language 😉 every week.