Javascript Interview Questions ( Closures ) - Lexical Scope, Output based Questions, Polyfills

  Рет қаралды 95,127

RoadsideCoder

RoadsideCoder

Күн бұрын

#Javascript #FrontendInterview #AccioJob
Javascript Interview Questions on closures will be discussed in this video including topics like Lexical Scope, Scope Chain, Output based Questions, Once and Memoize Polyfills, etc.
Apply Now for free (AccioJob) : bit.ly/3M4V88q
AccioJob is an IIT Delhi alumni-led startup that runs a 6 month Pay after Placement Full Stack Web Dev Training. Students are trained on Data Structures and Algorithms, Full Stack Web Development and backend web development. Students get placed above 5 LPA. AccioJob students are working at Amazon, Walmart, VISA, BharatPe, Paytm, ThoughtWorks and 190+ more companies.
Key Highlights of the program:
- ZERO fees till Placement above 5 LPA in Software Development
- Average CTC: 8.3 LPA; Highest CTC: 41LPA
- Dedicated placement team & Interview preparation
- Industry-relevant Projects, Mock Interviews, Resume & Portfolio building
🟦 Follow me on Twitter and u will clear your interview 🤓 -
/ piyush_eon
⭐ Support the channel and learn from me One on One -
/ @roadsidecoder
📖 Blog for this video -
roadsidecoder.hashnode.dev/cl...
🔗 Var, Let and Const Interview Video -
• Javascript Interview Q...
🔗 Functions Interview Video -
• Javascript Interview Q...
🔗 JavaScript Interview Series -
• Javascript Interview Q...
🔗 Cars24 Interview Experience -
• Frontend Interview Exp...
🔗 Unacademy Interview Experience -
• Frontend Interview Exp...
🔗 MERN Stack Tutorial with Redux -
• MERN Stack Project Tut...
🔗 React Beginner's Project Tutorials -
• React JS Project Tutor...
-------------------------------------------------------------------------
00:00 Intro
00:33 What is Lexical Scope?
02:22 A great oppertunity for you!
03:38 Lexical Scope - Interview Question
04:52 What is Closure?
05:43 Example of Closures
06:56 Why Closure?
08:19 Closure Scope Chain
11:12 Question 1 - What will it print ?
13:09 Question 2 - Write a function for this
15:28 Question 3 - Time Optimisation with Closures
18:07 Question 4 - setTimeout + block scope with Closures
23:07 Question 5 - Create a private counter
25:48 Question 6 - What is Module Pattern?
27:31 Question 7 - Make this run only once
30:14 Question 8 - Once Polyfill Implementation
34:02 Question 9 - Memoise/Caching Implementation
39:37 Question 10 - Closure vs Scope
40:22 Written Article for this video
-------------------------------------------------------------------------
Special Thanks to our members -
Trevor M
Srinivas Ayyagari

Пікірлер: 146
@RoadsideCoder
@RoadsideCoder 2 жыл бұрын
🔴 Get my Complete Frontend Interview Prep course - roadsidecoder.com/course-details ➡ Book an Interview Preparation call with me ( 20% OFF for limited time ) - topmate.io/roadsidecoder 🟪 Follow me on Instagram and u will clear your interview 🤓 - instagram.com/roadsidecoder/
@rxtechandtrading
@rxtechandtrading 2 жыл бұрын
not a bad service my friend
@ankitasingh734
@ankitasingh734 Жыл бұрын
These series are true GOLD, if possible keep on adding.
@hmehta051
@hmehta051 2 жыл бұрын
Great content, i recently gave a interview in cleartrip they asked this 4 question 1) write polyfill for promise 2)deep comparison of object 3) polyfill for call, apply,bind 4) polyfill for map, reduce,filter, forEach. It's help me and others if you can cover this questions
@ayushmukhopadhyay7470
@ayushmukhopadhyay7470 Жыл бұрын
Did u apply for entry level job ?
@saikumargatla4706
@saikumargatla4706 4 ай бұрын
Did they asked DSA. Will it be ok if I will solve the DSA questions in c++ instead of javascript. What do you think
@hmehta051
@hmehta051 4 ай бұрын
They hiring for ui developer so doing DSA in javascript gives you advantages over other candidates
@vinaypatil8009
@vinaypatil8009 Жыл бұрын
This series is god level series 🔥🔥🔥
@JudoboyAlex
@JudoboyAlex 2 жыл бұрын
Please do asynchronous/ concurrency javascript interview questions. They are the toughest. Thanks for this!
@show_me_the_moneyy
@show_me_the_moneyy Жыл бұрын
Nice video - closure examples which are more real world and practical are covered
@arpithiside
@arpithiside Жыл бұрын
What a wonderfule video!! Got to learn so much.. thanks a lot ❤❤❤
@ankushladani496
@ankushladani496 2 жыл бұрын
Most awaited video....👏💥
@itsMohak
@itsMohak 11 ай бұрын
You are terrific.
@sunnykalita675
@sunnykalita675 Ай бұрын
Bro thanks for sharing such knowledge in your videos but at the same time you need to make sure you are doing it right as so many people are watching these content , here in memoise polyfill your code is mistaken Json.stringyfy(...args) will not return us "500,500" in res object instead it will just jive us the first value of the array as we are not iterating the args array therefore even if we pass (500,500) and (500,600) as args we will get the same result and in the second function call res will mark the args as present in the object already, so to avoid we can do argsCache = args.join(",") then it will store in the res object as explained in the video by the way thanks for your content. happy coding to all
@friendshipwithjavascript
@friendshipwithjavascript 2 жыл бұрын
UseFul Content With Endless Wishes
@jenso413
@jenso413 Жыл бұрын
ahh this video finally made a bunch of things click for me, thanks man!
@iamankitdadhich
@iamankitdadhich 16 сағат бұрын
use IIFE to make it work with var for (var id = 1; id
@elton-react-dev
@elton-react-dev 8 ай бұрын
Amazing 🔥🔥🔥 thanks for that.
@A9kit.k
@A9kit.k 2 жыл бұрын
Thanks Piyush brother
@subhashgn1775
@subhashgn1775 2 жыл бұрын
Thank you for the great resource.🤝 very grateful to your contribution man🙌..
@RoadsideCoder
@RoadsideCoder 2 жыл бұрын
Thank you for appreciation ❤️
@DS-zr9gv
@DS-zr9gv Жыл бұрын
Through middle of this session and I already feel enlightened. Thank you so much :D
@RoadsideCoder
@RoadsideCoder Жыл бұрын
Wonderful!
@abhishekvishwakarma9045
@abhishekvishwakarma9045 Жыл бұрын
your Interview series is amazing 🔥 and worth watching 🚀
@RoadsideCoder
@RoadsideCoder Жыл бұрын
Thank you!
@ShivamSingh-ct1ix
@ShivamSingh-ct1ix 2 жыл бұрын
I never found something like this on youtube Gr8 job man
@rxtechandtrading
@rxtechandtrading 2 жыл бұрын
hes awesome seriously-knowledgeable to
@juniorWeb247
@juniorWeb247 Жыл бұрын
such a wonder full video with superb explanation,. Thanku so much for this information.
@RoadsideCoder
@RoadsideCoder Жыл бұрын
Welcome ❤️
@RahulChauhan-lm8mk
@RahulChauhan-lm8mk Жыл бұрын
Many thanks for this video. It's really helpful to clear my concepts. My praises and lots of love to you.🙌❤
@RoadsideCoder
@RoadsideCoder Жыл бұрын
Thanks a lot 🌸❤️
@hellisayhello
@hellisayhello Жыл бұрын
Hi RoadsideCoder, great lessons, your explanations are very clear, thank you for all this work! I still have a question about "Question 8 - Once Polyfill Implementation" You pass a "context" argument and then apply it to the function, but I don't quite understand in which cases it would be useful? In your example "this, arguments" are applied, and everything would work even if we delete "context" from the code. When is it useful to pass a "context" and what kind of data is expected for this argument?
@AmanSingh-qr3ld
@AmanSingh-qr3ld 2 жыл бұрын
Worthy 40 minutes. Keep sharing this kind of videos :-)
@rxtechandtrading
@rxtechandtrading 2 жыл бұрын
yup i agree
@RoadsideCoder
@RoadsideCoder 2 жыл бұрын
Thanks a lot 🙏
@SalmanKhan-lx9kp
@SalmanKhan-lx9kp 2 жыл бұрын
I genuinely enjoy your videos. will be giving interview in 2 months. Keep up the good work.
@RoadsideCoder
@RoadsideCoder 2 жыл бұрын
Best of luck!
@rxtechandtrading
@rxtechandtrading 2 жыл бұрын
me to
@TravelwithPujarini
@TravelwithPujarini 2 жыл бұрын
Excited for this video 🤩
@RoadsideCoder
@RoadsideCoder 2 жыл бұрын
🙌
@rxtechandtrading
@rxtechandtrading 2 жыл бұрын
This guy is great - good content and personality to
@RoadsideCoder
@RoadsideCoder 2 жыл бұрын
Thanks 🙌❤️
@shortflicks83
@shortflicks83 6 ай бұрын
Superb dear
@kedarkulkarni0074
@kedarkulkarni0074 2 жыл бұрын
Eyes on fire🔥🔥
@abhishekchaurasia_
@abhishekchaurasia_ 3 ай бұрын
Your explanation is very clear and the content is very useful. Can you make series for MERN interview questions
@ankushladani496
@ankushladani496 2 жыл бұрын
Great.... content quality...
@RoadsideCoder
@RoadsideCoder 2 жыл бұрын
Thanks a lot 🙏🔥
@A1996ARP2075
@A1996ARP2075 2 жыл бұрын
Great content on closures keep making more and also make on React challenges which are asked in interviews
@RoadsideCoder
@RoadsideCoder 2 жыл бұрын
Thanks a lot!
@rxtechandtrading
@rxtechandtrading 2 жыл бұрын
true
@ShubhamPatil-rr4on
@ShubhamPatil-rr4on 2 жыл бұрын
Great awesome amezing ....♥️💯 I don't have words for you ... Really nice content..... Keep it up
@RoadsideCoder
@RoadsideCoder 2 жыл бұрын
Thanks a lot brother
@pavithrasai1392
@pavithrasai1392 Жыл бұрын
In the private counter example, is the _counter variable not initialized every time the add or retrieve methods are called?
@anubhapant5227
@anubhapant5227 2 ай бұрын
Thankyou for this knowledge packed closures' video Pyiush. It is the most detailed video I found on KZbin and it covers all the important questons. Please make more of such content 🖖👍👌
@RoadsideCoder
@RoadsideCoder 2 ай бұрын
Thanks! I have created an indepth course covering all such topics - roadsidecoder.com/course-details
@hamzashaikh9164
@hamzashaikh9164 2 жыл бұрын
Wooow🔥🔥🔥🔥
@AnandKumar-dc2bf
@AnandKumar-dc2bf Жыл бұрын
Videos are good. But one suggesting instead of asking us to refer ur previous video just explain the functionality in one line & it will be much much helpful...
@akash_gupta_2090
@akash_gupta_2090 10 ай бұрын
done .. !
@emilyaung2963
@emilyaung2963 Жыл бұрын
For those of you wondering how to fix the var scope issue with closure. const c = () => { for(var i =0; i < 3; i++){ ((i) =>{ setTimeout(() => { console.log(i); },1000); })(i); } } c();
@bhupendersoni5467
@bhupendersoni5467 Жыл бұрын
function a(){ for(var i = 0; i { console.log(val) }, i*1000); } }
@praveengautam4689
@praveengautam4689 9 ай бұрын
for(var i = 0 ; i < 3 ;i++){ (function(i){ setTimeout(()=>{ console.log(i) }, 1000*i); })(i) }
@Lavkushkumar-cn9me
@Lavkushkumar-cn9me 2 жыл бұрын
Waiting... Hope we also get some logical type questions in it
@RoadsideCoder
@RoadsideCoder 2 жыл бұрын
Yes it has a lot of awesome logical questions!
@Lavkushkumar-cn9me
@Lavkushkumar-cn9me 2 жыл бұрын
@@RoadsideCoder thanks sir!
@anandstephan6020
@anandstephan6020 2 жыл бұрын
next video please on how this concept in applied in ReactJS
@kewalkandpal
@kewalkandpal 2 жыл бұрын
🔥🔥🔥🔥
@A9kit.k
@A9kit.k 2 жыл бұрын
Waiting
@ganeshtiwari2550
@ganeshtiwari2550 Жыл бұрын
hello sir like i m from commerce to learn deeper n easy understanding before entrying in full stack should i do any course before that can u say plz
@orz5516
@orz5516 5 ай бұрын
please add some algorithm questions and class / constructor functions question which are often ask in interviews. for example: implement a MinStack. By the way, a friend of mine got the setTimeout with var and let question in his last interview.
@RoadsideCoder
@RoadsideCoder 5 ай бұрын
here are the algorithm questions - kzbin.info/aero/PLKhlp2qtUcSZtJefDThsXcsAbRBCSTgW4
@annazacharz3959
@annazacharz3959 2 жыл бұрын
wouldn't the function function likeTheVideo(){ if(view !=undefined){ return; } view = 'dave' console.log("subscribe to ",view) } would also allow soolve problem 7 ? Awesome video btw
@cricketkeeda82
@cricketkeeda82 2 жыл бұрын
Great brother very helpful ❤️👏 Bhai please ek personal portfolio website making ke bare may sikhao next video may please 🥺
@RoadsideCoder
@RoadsideCoder 2 жыл бұрын
Yes, video for that will be coming soon!
@vijaykumar-ps5pq
@vijaykumar-ps5pq Күн бұрын
@user-uh7wz6zx6e
@user-uh7wz6zx6e Жыл бұрын
@Roadsidecoder For the time optimization without using closure part , as i give higher number time taken is less, any idea why is this happening? function find(index) { let a=[]; for(let i=0;i
@AjithKumarsham
@AjithKumarsham Жыл бұрын
Nice video but you did not clearly explain why the time got reduced in the time optimization :( I'm assuming it is meoizing the values underthe hood!
@yasharma2301
@yasharma2301 2 жыл бұрын
Great Video! Design patterns at the end of series?
@RoadsideCoder
@RoadsideCoder 2 жыл бұрын
Sure, I'll add them as well!
@aviii24x7
@aviii24x7 3 ай бұрын
what area all those extensions creates yellow line to tell bracket closings etc
@tmoneyy5697
@tmoneyy5697 2 жыл бұрын
I love your channel bro. Are you a self taught developer? I’m trying to learn react js and struggling a little bit
@RoadsideCoder
@RoadsideCoder 2 жыл бұрын
Yes I'm a self taught dev, contact me on Twitter and I'll help u out!
@lakshayoza
@lakshayoza 2 жыл бұрын
make a video on async await and callback hell
@RoadsideCoder
@RoadsideCoder 2 жыл бұрын
Sure!
@anandoganiya9070
@anandoganiya9070 2 жыл бұрын
Can you make for react
@tejusgroup6695
@tejusgroup6695 2 жыл бұрын
💯👌👌
@mayankpatel2062
@mayankpatel2062 8 ай бұрын
For revision : Q)What is closure? A)The function bundled with its lexical environment closed to that function simply function + Lexical environment
@saikumargatla4706
@saikumargatla4706 4 ай бұрын
Hey Piyush that Time Optimisation part was something new that I learnt today 16:20. Can you explain the the exact reason what closures did such that it took less time to execute the function
@himasailagonugunta2758
@himasailagonugunta2758 2 ай бұрын
same doubt can anyone help
@sagar7929
@sagar7929 2 жыл бұрын
Hello sir How are you? Please do more new series on nodejs with socket that use real world application! Thank you❤️
@RoadsideCoder
@RoadsideCoder 2 жыл бұрын
Yeah, Definitely bro ❤️
@sagar7929
@sagar7929 2 жыл бұрын
@@RoadsideCoder can't wait your new series and please do more series on nodejs expressjs🙏🏽🙏🏽 Thank you❤️🙏🏽
@RoadsideCoder
@RoadsideCoder 2 жыл бұрын
Follow me on Instagram @RoadsideCoder to stay updated!
@sagar7929
@sagar7929 2 жыл бұрын
@@RoadsideCoder sure sir
@ajaysankapal3175
@ajaysankapal3175 Жыл бұрын
how 'ran' variable storing the value return by 'func.apply()', because 'apply()' method does not return any value?
@abin_4857
@abin_4857 2 жыл бұрын
please make some videos on React interview questions.
@RoadsideCoder
@RoadsideCoder 2 жыл бұрын
Coming soon
@manibansal8047
@manibansal8047 Жыл бұрын
Hi Piyush, As per Ques no. 1 on line number 6 if (count ===0) so count is taking value from outer scope variable , but in below case it is throwing error : VM654:3 Uncaught ReferenceError: Cannot access 'x' before initialization at abc (:3:17) at :7:1 let x = 9 function abc(){ console.log(x); // It should print 9 as in Ques no. 1 count was accessing value from outer scope which is global let x = 5; console.log(x); } abc(); Please explain
@AjithKumarsham
@AjithKumarsham Жыл бұрын
Dood it's because of let and const is in temporal dead zone, If condition only executes it's respective code in it's block since let/const has block scope, In his example, count was not there in the function block it' was inside if block. but for your case since there's no block, It first check abc's scope while executing the code, so in the execution context it will first store x in temporal deadzone, so you have to initialize before accessing, Hope this answers your question
@pavithrasai1392
@pavithrasai1392 Жыл бұрын
In the once polyfill, can we use call instead of apply? If yes then how? Also you are modifying function param to null right, won't that cause any issues?
@RoadsideCoder
@RoadsideCoder Жыл бұрын
Yeah, in call you can spread the arguments array
@user-vr2pg4ln2j
@user-vr2pg4ln2j 2 ай бұрын
i didn't understand how closures helped in question 3 - Time Optimization . Can anyone please help?
@vikrambam1184
@vikrambam1184 2 жыл бұрын
Vikas Vishal i have to change all li : script :- let li = document.querySelectorAll('li') li.forEach(elm=>{ for(let i = 0; i
@ankitmehrotra8519
@ankitmehrotra8519 2 жыл бұрын
li. Foreach((el, indx) => el. Textcontent = indx)
@dheeraj2729
@dheeraj2729 2 жыл бұрын
Could you please do nodejs projects
@rxtechandtrading
@rxtechandtrading 2 жыл бұрын
I have on bro-free
@neerajmali-dx5dq
@neerajmali-dx5dq Жыл бұрын
Sir last ke 2 samjh me nahi aayebilkul bhi context and aaplly
@naveen9882
@naveen9882 9 ай бұрын
17:40 how did closure saved time can anyone explain ???
@ashwinbhargava3011
@ashwinbhargava3011 8 ай бұрын
In the previous `find` function the loop which filled the array runs a million times on each call. So when you called it twice, first for number 6 and then second for number 12, the loop ran twice for total of 2 million. Basically the loop was running on every call. The optimized `find` function ran the loop once and then returned a function which will just log out the array index value. So when the host run `const closure = find();`, the loop runs and an array is created and a function is returned which is stored in `closure` variable. Now when you use closure variable like `closure(6)` or `closure(12)`, the loop won't run as it has already run and the filled array is referenced to closure function via the concept of closures. So you may run the function 10 times the loop will run only a million times contrasting the previous function which would have ran 10 * million times. Feel free to ask a follow up.
@naveen9882
@naveen9882 8 ай бұрын
​@@ashwinbhargava3011damn, it's clear now. Thanks for the explanation 🤜🤛
@musiclovers8488
@musiclovers8488 Жыл бұрын
what will happen if we create simultaneously two function inside of a function?? like :- function a() { function b() { return "this is clouser or not?"; } function c() { return "is this a closure also ?"; } }
@mattwayne9128
@mattwayne9128 Жыл бұрын
Nothing. Because neither function ends up getting called.
@rakaa31
@rakaa31 2 жыл бұрын
i wanted to ask! from where you learnt JS??
@RoadsideCoder
@RoadsideCoder 2 жыл бұрын
MDN Docs
@aquibmohd
@aquibmohd Жыл бұрын
17:47 why did this take less time please explain?!
@user-ts2db7iy9z
@user-ts2db7iy9z Ай бұрын
case 1 : function x(){ var a = 7; function y(){ console.log(a); var a = 5; } y(); }; x(); output : undefined case 2 : function x(){ var a = 7; function y(){ console.log(a); } y(); }; x(); output : 7 case 3 : function x(){ var a = 7; function y(){ var a = 5; console.log(a); } y(); }; x(); output : 5
@SalmanShah95
@SalmanShah95 2 жыл бұрын
I am following your MERN chat app playlist and I need your help .Can you help me?
@RoadsideCoder
@RoadsideCoder 2 жыл бұрын
Sure, contact me on instagram @RoadsideCoder
@gauravdhenge6328
@gauravdhenge6328 9 ай бұрын
for(var i=0;i
@kedarkulkarni0074
@kedarkulkarni0074 2 жыл бұрын
Make this run only once question.. can we do it using Boolean? By default var will be false once it's called it becomes true
@RoadsideCoder
@RoadsideCoder 2 жыл бұрын
Yeah of course
@abhaaslakra2076
@abhaaslakra2076 11 ай бұрын
How many years of exp do you have? I'm preparing for 2 years and and I'm really very exhausted
@RoadsideCoder
@RoadsideCoder 11 ай бұрын
2
@TrainedFresher
@TrainedFresher 24 күн бұрын
function Namedis(){ var name="aksuman"; } Namedis() console.log(name) iam doing same thing but i am not getting error with this why?? unable to find answer plz help
@sachinmishra803
@sachinmishra803 17 күн бұрын
Please change your variable name because name is a reserved keyword in js
@mohininarwade1108
@mohininarwade1108 Жыл бұрын
Nice video but you did not explain why the time got reduced in the time optimization question… because of this still I have no clarity of the use of closures… can you please reply??? also I saw that you don’t even replies to your subscribers comments… please start replying
@rajsundarm48
@rajsundarm48 Жыл бұрын
Answer for 21:48 timeline var funcs = []; function createfunc(i) { return function() { console.log("My value: " + i); }; } for (var i = 0; i < 3; i++) { funcs[i] = createfunc(i); } for (var j = 0; j < 3; j++) { funcs[j](); } Hope it helps for you guys
@praveengautam4689
@praveengautam4689 9 ай бұрын
for(var i = 0 ; i < 3 ;i++){ (function(i){ setTimeout(()=>{ console.log(i) }, 1000*i); })(i) } this is what roadside coder wants
@friendshipwithjavascript
@friendshipwithjavascript 2 жыл бұрын
Love 💕 from Pakistan
@Pareshbpatel
@Pareshbpatel 2 жыл бұрын
{2022-05-18}
@emilyaung2963
@emilyaung2963 Жыл бұрын
did I just see hair extension ads on your browser ? lol
@InDiAnAjOnEs0002
@InDiAnAjOnEs0002 6 ай бұрын
I'm not getting the 100 years of good luck, what needs to be done?
@RoadsideCoder
@RoadsideCoder 6 ай бұрын
Follow @Roadsidecoder on Instagram
@muziahmed3419
@muziahmed3419 10 ай бұрын
In the question at 27.40 i.e question no 7, the functionality which you wanted is easily acheived by the below code, let view = 'Roadside Coder '; let num = 0; const singleFunction = ()=>{ if(num > 0){ console.log('already Subscribed') } else { console.log('subscribe to' + view) num++ } } what is the difference between the code which you wrote and the above code? In my approach, I didn't had to create inner function.
@ViSiOn-mtnr
@ViSiOn-mtnr 7 ай бұрын
You can do that as well as you have created a global counter but in video the counter is a local variable. Every time you call that function, the counter will be 0 this is why closure is used to store the reference of previous count
@pranshuadhwaryu6374
@pranshuadhwaryu6374 9 ай бұрын
100 of years of Reasearch lol 0:12
@rahulmishraER
@rahulmishraER 2 жыл бұрын
Nice way of explaining Buddy .... Try explaining in Hindi too .... Might increase lexical scope 😀 Thanks for researching and sharing knowledge 👏
@RoadsideCoder
@RoadsideCoder 2 жыл бұрын
Hahah good one!
@vardansharma6020
@vardansharma6020 6 ай бұрын
-var doesnt have a block scope !! -private counter Module pattern private functions are not returned
@neerajmali-dx5dq
@neerajmali-dx5dq Жыл бұрын
Sir please try to explain in hindi
@jrandy
@jrandy 5 ай бұрын
Wrong. A closure is not a function
@yashgupta-pi3li
@yashgupta-pi3li 4 күн бұрын
You literally do 100 of years of research?🤣🤣🤣🤣
@shatnuu_
@shatnuu_ 5 ай бұрын
stop smoking weed so high..
@siriusplayz5871
@siriusplayz5871 Жыл бұрын
the example at 10:01 is function currying, right? @roadsideCoder
@akankhyapanda7490
@akankhyapanda7490 Жыл бұрын
function fetchUsers(url, callback) { setTimeout( () => callback([ { name: "John", id: 1 }, { name: "Doe", id: 2 } ]), 100 ); } function getUsers() { let users; fetchUsers(`/api/v1/users`, (res) => { console.log(res); users = Object.assign([], res); console.log(users); }); return users; }; function logUsers() { console.log("Users are: ", getUsers()); } logUsers();How i can solve this for console.log
@nyimachoephell1004
@nyimachoephell1004 2 жыл бұрын
please check you Instagram message
Зу-зу Күлпәш.Курс (6 бөлім)
40:48
ASTANATV Movie
Рет қаралды 574 М.
【獨生子的日常】让小奶猫也体验一把鬼打墙#小奶喵 #铲屎官的乐趣
00:12
“獨生子的日常”YouTube官方頻道
Рет қаралды 110 МЛН
The Noodle Stamp Secret 😱 #shorts
00:30
Mr DegrEE
Рет қаралды 55 МЛН
STOP Using Classes In JavaScript | Prime Reacts
14:02
ThePrimeTime
Рет қаралды 211 М.
10 JavaScript Interview Questions You HAVE TO KNOW
13:41
James Q Quick
Рет қаралды 38 М.