Some JavaScript Part

kanon chakma
Nov 4, 2020

try..catch introduction

Syntax
try{
//code
}
catch(err){
//code to handle error
}

First execute try section.if any error occur in this section then execution stop and jump to the catch(err) block.In catch block you can access error object that consists at least error name and message in error details;

JavaScript engine read the code first then run it.When run the code that time error are visible and it can be handled.
In parse-time if occur any occur like syntactically problem error will not visible.

finally clause
The final clause is a optional clause in try…catch block.finally block will execute always
whether the error occur or not.Below this example code there is no error so finally block will execute;

finally clause

Primitives
primitive in JavaScript are not object or function.primitives can be replace but cannot be altered;
there are six types of primitives 1.number 2.string 3.boolean 4.big int 5.undefined and 6.symbol.

Expression
An expression is any valid set of variables,operator,literals that evaluate single value.
x=8 and 4+4 are two expression.In first expression assign a value in a variable with the help of assignment operator.
second expression simply evaluate to 8.

Statement
a Statement is an instruction,an action that executed.if block,function,loop etc are all statement;

--

--