@@ -482,10 +482,93 @@ console.log(typeof (3+4+'5')); //"75" //string
482482console.log(typeof (3+4+ +'5'));//number
483483//Explaination: To find out the typeof when the all the operation get complete thrn have to enclose in paranethisis. If we add + plus sign to any string it will convert to a number.
484484----------------------------------------------------------------------------------------
485- que 91
485+ let data = [1,2,3].map( num =>{
486+ if (typeof num === 'number') return;
487+ return num*2;
488+ })
489+ console.log(data); //[undefined,undefined,undefined]
490+ //Explaination: If jusr return then it will print undefined.
491+ ----------------------------------------------------------------------------------------
492+ function getInfo(member){
493+ member.name = "priya";
494+ }
495+ const person = {name : "supriya"}
496+ getInfo(person);
497+ console.log(person); //{"name":"priya"}
498+ //Explaination: If we pass an object as argument it will have call by refrence, means having same memory location.
486499----------------------------------------------------------------------------------------
500+ function Car(){
501+ this.make = "tata";
502+ return {make: "kia"};
503+ }
504+ const myCar = new Car();
505+ console.log(myCar.make); //kia
506+ //Explaination: return will overrite the property.If we didn't return then it will print tata.
487507----------------------------------------------------------------------------------------
508+ (()=>{
509+ let x = (y = 10);
510+ })()
511+ console.log(typeof x, y); //"undefined" //10
512+ //Explaination: x is a block scope, and we are trying to console x outside of x so that's why undefined.
513+ -----------------------------------------------------------------------------------------
514+ (()=>{
515+ let x = y = 10;
516+ })()
517+ console.log(typeof y); //number
518+ //Explaination: x is a block scope, and y is a var because y is not declared so by default it will be var.
488519----------------------------------------------------------------------------------------
520+ (()=>{
521+ let x = 10;
522+ })();
523+ (()=>{
524+ let x = 10;
525+ })();
526+ console.log(typeof x); //undefined
527+ //Explaination: x is a block scope.
528+ ---------------------------------------------------------------------------------------
529+ (()=>{
530+ let x = y = 10;
531+ })();
532+ (()=>{
533+ let x = y = 20;
534+ })();
535+ console.log(y); //20
536+ //Explaination: y is a var scope so it will overrite from 10 to 20
537+ -----------------------------------------------------------------------------------------
538+ let x =100;
539+ (()=>{
540+ var x = 10;
541+ })();
542+ console.log(x); //100
543+ //Explaination: x=10 contain inside a block because we already declare with 100 outside so it will print 100.
544+ -------------------------------------------------------------------------------------------
545+
546+
547+
548+
549+
550+
551+
552+
553+
554+
555+
556+
557+
558+
559+
560+
561+
562+
563+
564+
565+
566+
567+
568+
569+
570+
571+
489572
490573
491574
0 commit comments