ANS:-Var Vikash Undefined Console - Log (Vikash) Null
ANS:-Var Vikash Undefined Console - Log (Vikash) Null
ANS :- Primitive data types specify the size and type of variable values. It includes byte ,
short, long, float, double, Boolean and char.
2. What is the difference between a variable that is: null , undefined and undeclared ?
ANS :- Undefined :- It occurs when a variable has been declared but has not been assigned
with any value. Undefined is not a keyword.
Var Vikash;
Undefined
Console.log(Vikash);
Null :- It is a special value that represents an empty or unknown value.
Undeclared :- It occurs when we try to access any variable that is not initialized or declared
earlier.
Console.log(x);
ANS :- Do-while : The do-while statements combo defines a code block to be executed once, and
repeated as long as a condition is true.
The do-while is used when you want to run a code block at least one time.
<script>
let text = “ “ ;
let I = 0;
do {
text += I + “<br>”;
I ++;
</script>
While : The while statement creates a loop that is executed while a condition is true.
<script>
let text = “ ”;
let I = 0;
while (I < 5) {
I ++;
</script>