JavaScript

01. Primitive value:

Mehedisabuj
3 min readMay 18, 2021

In javaScript primitive values data, next time will not change and has no object and method. String, Number, Boolean, Undefined, Null are the data types of primitive values.

02. Try-Catch:

Try-catch is a runtime error handling method. when we write code block and sometimes we think this block next time may come error just than we should this block keep in the try-catch method. if the try fiend any error, try block send to catch block as a parameter. In the catch block, you can show them on the web page and console. see the example below.

03. Try-Catch-Finally:

we know that if any error stays in the code, the program has stopped there and doesn't see the next code output. it’s very disappointing. here we should use the Finally block with the try-catch method. the finally block handle ingnor the error. and the next code continues on and shows the result. so in this case try-catch-finally are working step by step, try block fiend error and send to catch, catch show the error and finally ingnoer the error for help continue the next code. see example.

04. Function :

Function like set a format, manny similar work function can make short time. for writing a simple function you make sure 6 steps. the first step write “function” key word, the second step gives the function “name” make sure parameter “(num1, num2)” and “{}”, and write in the curly bearcat what you will do “{ let result = num1 + num2, return result}”. and call the function where you will do similar work like let x = add(). see the example.

05. Object:

The object is multiply data storage. a student has many data like name, id, section, class, etc, and all data you can store in a single object. see the exmole create an object

create an object

06.Checking a Type:

If you confused that what type the data. don't worry you just question the javaScript method “type of”. and javascript is ready to answer its string, or boolean or number or null, etc. see the example blew.

07 Var Declarations and Hoisting:

var is the variable shortage and global variable. Hoisting is can be use variable before declaring. hoisting is javascript default behebior. example below

08.Block Level Declarations:

If you declare a variable in a block using any of let and const you can not access the declaration outside that block. Block can be created in the following places. follow the example

--

--