1. Discuss the scope of var, let, and const?
Answer : In JavaScript three of them are used to declare variables. Scope of var, let & const are discussed below-
var: var declarations are globally scoped or function scoped. Developers nowadays use less var. var creates variables that can be reassigned another value.
let: let is declared as block scope. let creates variables that can be reassigned another value. Developers nowadays use more let. It can't define before it is declared.
const: const is declared as block scope. const creates "constant" variables that cannot be reassigned another value. If there is no need to change the value of a variable, then it is good to use const to declare a variable. Developers nowadays use more let. It can't define before it is declared.
2. Tell us the use cases of null and undefined
Answer :
Null: In JavaScript, Null is an assignment value, which is an empty value. It means nothing or a blank value.
Which is the intentional absence of the value. It is one of the primitive values of JavaScript.
Syntax: null
Undefined: In this variable has been declared, but the value is not assigned yet in that variable. Then the output is undefined. To prevent undefined as output, one must assign a value to the declared variable
Syntax: undefined
3. What do you mean by REST API?
Answer :
REST API : REST stands for Representational State Transfer and API stands for Application Programming Interface.
Application Programming Interface means a set of rules that define how a device or an application is going to communicate or be connected with each other.
Representational State Transfer (REST) refers to an architectural style which is used to developing web services.
REST API means an API that conforms to represent the state transfer architectural style or design principle of the REST. It is part of the integration framework.