-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquestion.html
92 lines (74 loc) · 4.09 KB
/
question.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<!DOCTYPE html>
<html lang="en" data-theme="light">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Questions</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/full.css" rel="stylesheet" type="text/css" />
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body>
<header>
<div class="bg-base-100 flex flex-col items-center sm:flex-row sm:justify-between sm:items-center p-4 ">
<div class="navbar-start flex">
<img src="./images/Logo.png" alt="">
</div>
<div class="navbar-end flex justify-center sm:justify-end space-x-4 mt-4 sm:mt-0 ">
<a class="btn btn-secondary " href="./index.html">Home</a>
</div>
</div>
<hr>
</header>
<main>
<section class="mx-auto mb-5">
<h1 class="text-5xl mb-5">Discuss the scope of var, let, and const</h1>
<p class="font-medium text-lg">In JavaScript, variable scope determines where a variable can be accessed. Three
keywords define scope: var, let, and const.
<br>
<span class="mb-5 line-clamp-1">
1. Var:
Function Scope: Limited to the function where declared. If outside any function, it becomes global.
Hoisting: Variables are hoisted to the top of their scope, potentially causing unexpected
behavior.<br>
</span>
<span class="mb-5 line-clamp-1">
2. Let:
Block Scope: Confined to the block where declared, like within loops or conditionals.
No Hoisting: Variables must be declared before use, enhancing predictability.<br>
</span>
<span>
3. Const:
Block Scope: Block-level scope, similar to let.
Constants: Values cannot be reassigned after declaration, except for properties or elements in
objects and arrays declared with const.<br>
</span>
</p>
</section>
<section>
<h1 class="text-5xl mb-5">Tell us the use cases of null and undefined</h1>
<p class="font-medium text-lg ">Use Cases for null:
<br>
<span class="mb-5 line-clamp-1">
1. Intentional Absence: Used to indicate a deliberate absence of a value, often for resetting variables..<br>
</span>
<span class="mb-5 line-clamp-1">
2. Default Initialization: Can be a starting point when no value is assigned initially.
</span>
<span class="text-lg line-clamp-1">Use Cases for undefined:</span><br>
<span class=" line-clamp-1">
1. Nonexistent Object Properties: Result when trying to access properties that don't exist in an object.
</span><br>
<span class="line-clamp-1">
2. Missing Function Arguments: Occurs when calling a function with fewer arguments than expected.
</span><br>
<span>
3. Missing Function Arguments: Occurs when calling a function with fewer arguments than expected.
</span>
</section>
<section class="mt-10">
<h1 class="text-5xl mb-5">What do you mean by REST API?</h1>
<p class="font-medium text-lg">REST API, or Representational State Transfer Application Programming Interface, is a standardized way for software applications to communicate over the internet. It uses HTTP requests to perform operations on data resources, typically in JSON or XML format. REST APIs are designed around a set of principles, including statelessness, client-server architecture, and a uniform and predictable URL structure. They are widely used for building web services, allowing different systems to interact and exchange data efficiently</p>
</section>
</main>
</body>
</html>