-
Notifications
You must be signed in to change notification settings - Fork 0
/
day39.html
44 lines (29 loc) · 1.32 KB
/
day39.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
<!-- Not Defined V/s Undefined in Javasrcipt -->
<!--
Undefined:
In JavaScript, undefined is a special value that a variable can have when it has been declared but not assigned a value.
When you declare a variable without assigning a value to it, it automatically gets the value undefined.
Not Defined:
When you encounter the term "not defined" in the context of JavaScript, it typically refers to a variable that has not been declared or is not in the current scope.
If you try to use a variable that has not been declared using var, let, or const, you will get a ReferenceError, and the variable is said to be "not defined."
Undefined: The variable has been declared but not assigned a value.
Not Defined: The variable has not been declared, or it is not in the current scope.
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Not Defined vs Undefined</title>
</head>
<body>
<h1>Not Defined Vs Undefined in Javasrcipt</h1>
<script>
console.log(a) // return undefined
var a = "Value";
// It means the variable a is declared but not assigned value yet
console.log(y) // not defined
// It means the variable y didn't get memory space(Not Declared)
</script>
</body>
</html>