Miscellaneous of JavaScript Basic- Md Iqbal Hossain

Md Iqbal Hossain
3 min readMay 7, 2021

--

When you will start working with javascript you basically work by some types of data. There are two types of data. 1. Primitive 2.Object & functions

Primitive type

This type is the very basic type of data which are String and Number. Doing programming is actually doing something with the values. So the values will look like …

console.log(4); // 4
console.log(“primitive”); // primitive
console.log(undefined); // undefined

Object and Function

Object and function are the special types of values, looks like…

Value of object(Array is also an object)
Value of function
value of object

Checking Data types

You can simply check data types by javascript. Look below.

checking undefined
checking string type data
checking number type

try… catch in javascript

Like all the programming language javascript also have the try… catch feature for error handling. A try statement lets you test a block of code for errors whereas A catch statement lets you handle that error. The format looks like this:

finally in javascript

The javascript's finally statement acts like the neutral ground or the final ground for your try…catch block. Finally, you are basically saying that this code in the final statement should run no matter what happens in the try/catch (error or no error).

ES6 related syntax

let const var:

The let keyword allows you to declare a variable with block scope. The const keyword allows you to declare a constant (a JavaScript variable with a constant value). Constants are similar to let variables, except that the value cannot be changed. let and const are the es6 features in replace of var with the

let vs const
let vs var

Arrow function:

Arrow functions allow a short syntax for writing function expressions. See the change over ES5 to ES6

Thanks for today. See you soon.

--

--