Learn JavaScript Fundamentals

Luis Castillo
2 min readJan 31, 2022

--

What Is JavaScript?

JavaScript is a programming language that allows you to implement complex features on a website, such as dynamic elements or interactivity. It is the third layer of the layer cake of standard web technologies, two of which (HTML and CSS) we have covered in much more detail in other parts of the Learning Area.

Learning the Fundamentals of a language is essential to understanding libraries and frameworks. Today I will share some of the JavaScript Fundamentals you need to know.

String

A string stores a series of Unicode characters. The text can be inside double quotes " or single quotes ''.

Strings inherit methods from String.prototype. They have methods like : substring(), indexOf() and concat() .

"text".substring(1,3) //"ex"
"text".indexOf('x') //2
"text".concat(" end") //"text end"

Strings, like all primitives, are immutable. For example, concat() doesn’t modify the existing string but creates a new one.

Variable

Variables are placeholders for information. Think of it as a memory bucket that holds your data.

Use the keyword var let const to declare a variable and give it a name. This will initialize it. You can assign a value to it using =

The let declaration has a block scope.

The value of a variable that is not initialized is undefined

A variable declared with const cannot be reassigned. Its value, however, can still be mutable. const freezes the variable, Object.freeze() freezes the object. The const declaration has a block scope.

Operators

Learn how to use operators in coding, such as math operators (add, subtract, multiply, and divide) and logical operators (and & or).

The && operator returns true if the left and right sides of the operator are both true. Otherwise, it returns false.

--

--