File tree Expand file tree Collapse file tree 1 file changed +56
-0
lines changed
Expand file tree Collapse file tree 1 file changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -486,6 +486,62 @@ let a = 12345;
486486*/
487487
488488
489+ /*
490+ What is the difference between null and undefined?
491+
492+ • Null and undefined mean the same thing in that they have no value, but null is set by programmers and undefined is set by JavaScript.
493+
494+
495+ o Null is used by programmers to indicate NO VALUE.
496+ Null will never be used by JavaScript for you… variables with no value will always be undefined. Only the programmer will set a variable to null.
497+
498+ o Undefined is used by JavaScript to be NO VALUE.
499+ Undefined is used for uninitialized variables with no value ( let a; ) and is also used in the case of missing parameters or unknown properties.
500+
501+ What is NaN?
502+
503+ • NaN stands for “not a number” and is used to define a number that’s not really a number but like a bad calculation.
504+
505+
506+
507+ The typeof of NaN is number.
508+
509+ console.log(typeof(NaN)) // "number"
510+
511+ NaN compared to any other number is FALSE.
512+
513+ console.log("abc"/4); // "NaN"
514+
515+ NaN compared to NaN is also FALSE.
516+
517+ console.log(NaN === NaN); // "false"
518+
519+
520+ How do you check for NaN?
521+
522+ • To check for NaN or check whether or not something is a number, you can use an inbuilt function called isNan().
523+
524+
525+ o Using Nan has some drawbacks.
526+ For example, if you pass a string to the inbuilt function, you will get true.
527+ JavaScript Output
528+ console.log(isNaN(NaN)) true
529+
530+ */
531+
532+
533+
534+
535+
536+
537+
538+
539+
540+
541+
542+
543+
544+
489545/*
490546RESOURCES
491547=========
You can’t perform that action at this time.
0 commit comments