Posts

Showing posts from 2024

Come out from your comfort zone -Bitch :(

 Yes, this year I have done. a switch but yes there are so many things that I am not doing, That I should do. Let's create a table of all the good things and bad things that happened this year.

New Start - Sprint 1 - 3 Nov 2024 - 9 Nov 2024

03-11-24 DSA- Patterns and Basic Maths Difference between process-stdout-write and console.log process.stdout.write() is a buffer/stream it continuously prints the information as the data being retrieved and doesn't add a new line it only takes a string argument rest it will throw a type error mostly it is used for printing patterns

Notes Singlife

 https://dev.to/narendersaini32/how-to-block-and-e-in-number-input-1hoe

PC and project details

Image
 

docs

Image
  Arc and axe dev tools Andi

info

 1.italic _ _ 2.bold **  ** 3. italic+ bold _**  **_  or **_ _** --> order doesn't matter when can use anything in the start 4. headers - 6 types of headers #    ---->h1 ##   ---->h2 ###  ---->h3 .... 5.Links --> inline links []() ---> Reference links [Ankit Tyagi][id] [id]: www.google.com 6.images -->![Benjamin Bannekat](https://octodex.github.com/images/bannekat.png) --->reference images   7. Blockquotes > 8.Lists          --> unordered --> * --> ordered -->  1. 2. 9.Paragraphs a) Front End frameworks and technologies like React.js, Vue.js, Anjular.js, JavaScript, HTML5, CSS3, Jasmine, Karma, Python. b) 2+ years of strong hands-on design & development experience with Java Server Development in Java, EE, Spring, Hibernate, Spring MVC, Struts, Hibernate, Java Web App Server (e.g. JBoss, Tomcat). c) Strong hands on experience with ...

Package

 Diksha - 5 years - 22LPA Diksha 7 years  2 yrs 2 mos  1 yr 4 mos 3 yrs 9 mos 6 yr + 1yr+ 0.3yr --> 7.3 years --> 30LPA webpack   2 yrs  2months  2 yrs 5 mos 4yr 7months -->18.34 LPA Akshansh - 12yrs -> 1cr
 // //interceptor // //npm package // //mfe  // interface parent{ //     name ?: string | Array<String> ; // } //rtk interface vs type // interface child extends parent{ //     age: number; // } // function Button(onClick ,type='fill'){ //  <button id="btn"  onClick={onClick}>Click</button> // } var a = [1,2,[3,[4,[5],6]],7,8,[9]]   //output:-  [1,2,3,4,5,6,7,8,9] const flatArray =(arr,res=[])=>{     for(let el of arr){         if(Array.isArray(el)){             flatArray(el,res)         }         else{             res.push(el)         }     }     return res; } const res= flatArray(a); console.log(res)

Axtria

  //contrcutor // render //  // useMemo(()=>{    // const ab=function sum(){ //   return a+b;  // } //   return sum // },[a,b])  // useCallback(()=>{ // return function(){    // }   // },[]) // React.memo(<child />) //==> pure component  //interseptor // var a=3; // var b=a++;//4 // var c=++a;//3 // console.log(a,b,c)//3,4,3 // const a = { x: 1, y: 2 }; // const b = a; // b.x = 3; // console.log(a); // console.log(b); const length = 4; const numbers = []; for (var i = 0; i < length; i++);{ numbers.push(i + 1); } //0+1 //1 //2 //3 [1,2,3,4]
Image
 

Newgen

 /* find the max occurence of element in arr output =>{   3:4 } */  const arr =[1,2,2,2,,4,5,3,3,3,3]; function maxOccurance(arr){   let hashMap={}   let maxOccuranceKey=0;   let ans={}     for(let el of arr){       if(hashMap[el] !==undefined){         hashMap[el]+=1;         maxOccuranceKey = Math.max(maxOccuranceKey,hashMap[el])       }       else{         hashMap[el]=1;       }   }   Object.entries(hashMap).forEach(([key,val])=>{   if(val===maxOccuranceKey){     ans[key]=val;   }   })   return ans; } const res= maxOccurance(arr); console.log(res) // const optimized=useCallback(()=>{    // },[])

Magic edtech

 https://codepen.io/ankittyagi206/pen/GRLbRNy // function outer(x){ //     return function(y){ //         return x*y; //     } // } // console.log(outer(3)(4)) //map --> [] --> [] const obj={     name:'ankit' } const obj2= {...obj,...{     age:26 }} delete obj2.name console.log(obj2,obj) deep copy shallow copy promises async await // Given a string S containing alphanumeric characters, // The task is to calculate the sum of all numbers present in the string. // Output: 24 // Explanation: 1 + 23 = 24 // const input=  '1abc22' // function calculateSum(input){ //   let numArr =[];    //   for(let i=0; i<input.length;i++){ //     if(+input[i] && +input[i+1]){ //       let newNum=Number([input[i],input[i+1]].join('')); //       numArr.push(newNum) //     } //     else if(+input[...

Aristocrat --

learn classes and oops concept in js  // const arr=[1,2,3] // interface puppy{ //   color:String // } // interface cat extends puppy{ //   legs: Number  // } //Sort this array of objects by key // var ob = [ //   { "abc": 100 }, //   { "mno": 200 }, //   { "def": 100 }, //   { "pqr": 500 } // ]    // const res=ob.map((el)=>Object.keys(el)[0]); // let ans= res.sort().reduce((acc,curr)=>{ //   acc[curr]= ob.find((el)=>Object.keys(el)[0]===curr)[`${curr}`] //   return acc; // },{}) // console.log([ans]) const obj ={   name:'Ankit',   printName:function(    console.log(this.name)   ) } const obj2 ={   name:'Ankidddt' } obj.printName.call(obj2) //call ,apply --> // printName.call(thisArg,'state','') // printName.apply(thisArg,['','']) //

Patch infotech

Image
 // let a= true; // setTimeout(()=>{ // a=false; // },2000)   // while(true){ // console.log(' — inside while —') // } // var a=5 // console.log(a++)//5 // console.log(a)//6 // const foo = () => { //   console.log(this.name) // } // foo.call({ name:'John'}) console.log(a) console.log(b) var a=b=5;

sapient

Image

JS interview Questions -Piyush Garg

 // console.log("Value of Age is",age); // var age=2 // console.log("Value of Age is",age); /**  * undefined  * 2  *   * Because of Hoisting  * Global execution context  * Memory phase --> js will traverse whole code and it will load that in memory phase  * code phase  *  */ // age =100; // console.log("Value of age is",age); // let age =30; /**  * Throw reference Error  * trying to acess age before initialization  *   * let and const are hoisted differently  * they are hoisted inside    Temporal Dead Zone *the area of a block where a variable is inaccessible until the moment the computer completely initializes it with a value.     */ // myFun(); // var myFun = function(){ //   console.log('First') // } // myFun(); // function myFun(){ //   console.log('Second'); // } // myFun(); /**  * Second  *   * First  *   * First ...

Successive Interview

Image
 // const a=5; // const b= new Number(5); // console.log(a===b); // setTimeout(() => { console.log("A") }, 1000); // setTimeout(() => { console.log("B") }, 0); // Promise.resolve().then(console.log("C")); // Promise.resolve().then(setTimeout(() => { console.log("D") }, 0)); // console.log("E") // setTimeout(() => { console.log("F") }, 1000); // 'E // 'c' // 'D' // 'B' // 'A' // 'F' // const obj1={ //   name:'Ankit', // printName:function(state){ //   console.log(this.name+state) // }  // } // const obj={ //   name:'tyagi' // } // obj1.printName.call(obj,[''])  var a=[1,0,1,0,0,0,1,0,1,1,0,1,1] // count 0's and 1's // output: { '0': 6, '1': 7 } let map={}; for(let ele of a){      if(map[ele] !==undefined){     map[ele] +=1;   }   else{     map[ele]=1   }    } console.log(map) let ele=10; function outer(){   return ()=>{   ...

Piyush Garg Content

 Lazy Loading and code splitting
 const [val, setVal]=useState("some"); const change=()=>{ setVal(5); add(); } const add=()=>{ console.log(val); } export default function App() {   const [emp, setEmp] = useState({ name: "A", age: 5 });   const update = () => {     emp.age = 10;     console.log()     setEmp(emp);   };   return (     <div className="App">       <h1>Hello CodeSandbox</h1>       <h2>{`${emp.name} : ${emp.age}`}</h2>       <button onClick={update}>Update</button>     </div>   ); } import { useState } from " react " ; const App = () => {   const [ user , setUser ] = useState ({ firstName : "" , lastName : "" }) ;   const updateUser = ( first , last ) => {     setUser ({ ... user , firstName : first }) ;     if ( last ) {       updateLastName ( la...

Offset index of an array

Image
const numbers = [1,2,3,4]; const output =move(numbers,1,-1);  [2,1,3,5,4] console.log(output);  function move(array,index,offset){ } https://www.freecodecamp.org/news/swap-two-array-elements-in-javascript/   /**  * Move an element  * input ->[1,2,3,4,5];  * move(arr,index,offset)  *   * we should not modify the orignal array  *   * if not possible --> invalid  * move(input,0,-1)  *  */ const move =(arr,index,offset)=>{   const position =index+offset;      if(position>=arr.length||position<0){         return 'Invalid';   }      const clone =[...arr];   let element=clone.splice(index,1)[0];   clone.splice(position,0,element)   return clone; } const arr=[1,2,3,4,5]; console.log(move(arr,0,5))  
// const movies =[ // {title:'a',year:2018,rating:4.5}, // {title:'b',year:2018,rating:4.7}, // {title:'c',year:2018,rating:3}, // {title:'d',year:2017,rating:4.5}, // ] // //All the movies in 2018 with rating >4 // const output=movies // .filter((movie)=> movie.year===2018 && movie.rating>=4) // .sort((a,b)=>b.rating-a.rating) // .map((movie)=>movie.title) // console.log(output) //circle.radius=2 (write and read) //circle.area --> x.yxcwh (read only) // const circle={ // radius:1, // get area(){ // return Math.PI * this.radius**2 // } // } // circle.radius=12 // circle.area=1// read only can't be modified // console.log(circle.radius) // console.log(circle.area) const numbers= [1,0,-1,2,3]; const output=numbers.filter((num)=> num>=0); console.log(output) //sum(1,2,3,4) =>10; // const sum =(...args)=>{ // return args.reduce((acc,curr)=>acc+curr,0) // } // consol...

Notes

Image
26-02-24 React 19 is coming very soon. React 19 is coming with a major update. React complier They have already integrated this on Instagram. https://daily.dev/blog/react-19-everything-you-need-to-know-in-one-place

Langchan with JS

How to integrate AI with your website? Introduction to Langchan https://youtu.be/DSkyw0cXorM?si=E90M0urX14IuvGCU What is LLM --> Large Language Modal Language that we need to communicate and getting response from AI, LLM --> as it is worked on lagre

Create Content Creation

Image

Ideation

Food Delivery app with some advance features 1. search food just by saying 2. according to your mood it will suggest you foods will show results 3. save the address after filling once 4. keyboard shorcuts to place order in minimum clicks 5. remeber my old choice --> by using the shortcut I can reorder in one click 6. auto order at a particular time --> schedule food => if not possible that day alert me in advance or find some good rating alternative with same amount range 7. Langunage change 8. Offline support

RDP (Remote Desktop)

Image
 Black Screen, Not Working Windows  not able to open anything not able to see window taskbar Restarted multiple times--> but still not working go to taskmanager --> ctrl+ shift+ esc create new task