Introduction to Javascript part-2

Rima Wahid
3 min readMay 6, 2021
Javascript Data Types

Data Type: Javascript engines don’t have to actually create an object to wrap the primitive when you access object properties; they only have to emulate this type of behavior.

There are exactly five primitive data types in JavaScript: string, number, boolean, null, and undefined. Only the string, number, and boolean data types have complementary constructor objects.

String: JavaScript strings are used for storing and manipulating text. We can write string using single or double-quotes.

Number: JavaScript has only one type of number. Numbers can be written with or without decimals. It’s used for math calculation.

Boolean: JavaScript has a Boolean data type. Boolean represents one of two values: true or false. It’s used for logical operation.

Coding Style: Our code should be as clear as possible and easy to read. That is actually the art of programming. We can follow the following rule to keep the court clear.

Error handling: No matter how great we are at programming, sometimes our scripts have errors. These could be due to our error, an unexpected user input, an erroneous server response, and a thousand other reasons. So we should know about “try…catch” so that we can handle the errors easily.

First, we need to know “try…catch” syntax. The try…catch construct has two main blocks: try, and then catch.

First, the code tries to execute if there is no error the code run and gives the expected output else if there is an error execution is stopped and will contain an error object with details about what happened.

What is callback function?

When we can pass a function as a parameter in the outer function. and it calls that outer function. This is a CallBack function.

function print(name, callback) {
callback(name)
}print('Hossain', (name) => {
console.log('My Name is ' + name); // My Name is Hossain
});

What is DOM?

DOM is a programming API for HTML or XML documents. it defines the logical structure of the documents and the way to access to manipulate. The DOM represents a document with a logical tree. each branch of the tree ends in a node and each node contains objects.

--

--

Rima Wahid
0 Followers

Throughout my career as a front end developer I've emphasized the importance of scalable and well documented.