File tree Expand file tree Collapse file tree 1 file changed +83
-0
lines changed
JavaScript Interview/Most Imp MCQ Expand file tree Collapse file tree 1 file changed +83
-0
lines changed Original file line number Diff line number Diff line change @@ -592,6 +592,77 @@ console.log(x && 5); //5
592592console.log(0 && 5); //0
593593console.log(x || 5); //10
594594console.log(0 || 5); //5
595+
596+
597+ Day 4
598+ ------------
599+
600+ 1.
601+ console.log(a); //undefined
602+ var a = 5;
603+
604+ 2.
605+ console.log(a); //ref error
606+ let a = 5;
607+
608+
609+ 3.
610+ sayHi(); // Hello! Function Declaration hoisted
611+ function sayHi() {
612+ console.log("Hello!");
613+ }
614+
615+ 4. greet(); //ref error because Funtion expression not hoisted
616+ var greet = function() {
617+ console.log("Hi there!");
618+ };
619+
620+
621+ 5.
622+ var x = 10;
623+ function test() {
624+ console.log(x); //undefined
625+ var x = 20;
626+ }
627+ test();
628+
629+
630+ 6. let a = 5;
631+ {
632+ let a = 10;
633+ console.log(a);//10
634+ }
635+ console.log(a);//5
636+
637+
638+ 7. function check(x) {
639+ if (x) {
640+ console.log("Truthy");
641+ } else {
642+ console.log("Falsy");
643+ }
644+ }
645+ check([]); //truethy
646+ check({});//Falsy
647+ check("");//falsey
648+
649+
650+ 8. const num = 5;
651+ // num = 10;
652+ console.log(num);//5
653+
654+
655+ 9. console.log(typeof NaN === "number"); // true
656+ console.log(NaN === NaN); //false
657+
658+
659+ 10.
660+ console.log(1 + "2" + "2"); //122
661+ console.log(1 + +"2" + "2") //32
662+ console.log(1 + -"1" + "2");//02
663+ console.log(+"1" + "1" + "2"); //112
664+ console.log("A" - "B" + "2"); //NAN2
665+ console.log("A" - "B" + 2); //NAN
595666*/
596667
597668
@@ -614,6 +685,18 @@ console.log(0 || 5); //5
614685
615686
616687
688+
689+
690+
691+
692+
693+
694+
695+
696+
697+
698+
699+
617700
618701
619702
You can’t perform that action at this time.
0 commit comments