DEV Community

Cover image for JavaScript Fundamental Briefing
Khalil Dev
Khalil Dev

Posted on • Updated on

JavaScript Fundamental Briefing

Hey programmers!

I hope you have a productive day. This post briefly covers the fundamental of JavaScript programming language. Since fundamental is the most crucial step, it is useful to refresh it after sometimes again and again. It is also important for newbies where to start and move to next one.

Okay! Let's dive in with a bit of motivation.

1. Why JavaScript?
JavaScript has a huge eco system now. It can be used in frontend or UI development, backed or server-side development, desktop application development and even in machine learning. To master it, it is crucial to understand the fundamentals first. Here is a simple roadmap:

2. Variables declaration
Like other programming languages, JavaScript also declare and use variables but a little bit differently. Keywords let, var and const is used to declare variables. const is used to declare constants in JavaScript. Read more

3. Data types
Data type helps program to operate correctly on data. In JavaScript, there are two main types of data; primitive and non-primitive. Primitive data type includes String, Number, Bigint, Boolean, Symbol, Null and Undefined. While non-primitive includes objects and arrays.Read more

4. Type conversion
Sometimes data needs to be converted from one type to another one. For example; converting a string to a number or number to Boolean and vice-versa. JavaScript provides methods to do type conversion. Read more

5. Math Operation
There are several math operations namely “unary”, “binary”, “operant”, basic mathematic operation, reminder operator, exponentiation, string concatenation, assignment operator, increment and decrement operator, bitwise operators. Each of these operations have important role when manipulating data.

6. Variable comparison

Comparing two values is normal in every programming language. In JavaScript, it can be done by greater than, less than, equal, not equal, type comparison and string comparison operators.

7. If and switch statement
Sometimes, it is needed to perform different actions based on different conditions. There are three popular ways to do this. One way is using if statement, another is if ... else statement and last one is switch statement. Each of the statement is used to check conditions but they should be used in its suitable places.

8. Logical Operators
Logical operators provide another way to check conditions. In JavaScript, there are four logical operators which are OR (||), AND (&&), NOT (!), and Nullish Coalescing ( ?? ).

9. Loops
Loop is a block or a piece of code which is used to execute a repeated task. Basically, there are three types of loops such as for, while, and do...while loops. Beside these, JavaScript provides a few more way to loop over a list of data such as forEach, for...of and for...in loops.

10. Functions
Function is a block of code which is used to execute a particular task. It can be called in different place as much as needed. It’s important to understand function declaration, function parameter, default and alternative parameter, arguments, and return value.

In addition to the above, In JavaScript there also feature like function expression, arrow function and callback functions that need to be understood.

11. Objects
In JavaScript, an object is a collection of key-value pairs, where the keys are strings or symbols and the values can be any type of data, including primitive values (e.g., numbers, strings, and Booleans) or other objects.

12. HTM DOM
The Document Object Model (DOM) is a programming interface for HTML and XML documents. It represents the structure of a document as a tree of nodes, where each node corresponds to an element or an attribute in the document.

13. Other JavaScript specials
Interaction
Natively, JavaScript printout a variable either in console or on-screen pop-up. Console log is the most popular way to console things while coding because it prints out data in several beautiful ways.

Strict mode
Putting “use strict” at the top of JavaScript file enable all features of modern JavaScript. This should be written at the top (first line).

Without "use strict", everything still works, but some features behave in the old-fashioned, “compatible” way. We’d generally prefer the modern behavior.

What's next
I will write more and inadept explanation with code examples about each of the above topics. If you are looking for premium content about web development stick around.

I will also write about CSS and web development frameworks like ReactJS and NodeJS.

Top comments (0)