Reference MDN :- A closure is the combination of a function bundled together (enclosed) with references to its surrounding state (the lexical environment). In other words, a closure gives a function access to its outer scope. In JavaScript, closures are created every time a function is created, at function creation time.
// Define an outer function function outerFunction(outerVariable) { // Define an inner function (closure) return function innerFunction(innerVariable) { console.log('Outer Variable: ' + outerVariable); console.log('Inner Variable: ' + innerVariable); }; } // Create a closure by calling outerFunction const closureFunction = outerFunction('Hello'); // Check the type of closureFunction console.log(typeof closureFunction); // "function" // Invoke the closure closureFunction('World'); // Output: // Outer Variable: Hello // Inner Variable: World Conclusion: closure is a function is not a wrong statement .
From MDN, A closure is the combination of a function bundled together (enclosed) with references to its surrounding state (the lexical environment). In other words, a closure gives you access to an outer function's scope from an inner function. In JavaScript, closures are created every time a function is created, at function creation time. Hence, closure is not a function. You are checking type of function, that's obviously not closure.
@@binamralamsal A closure is a function having access to the parent scope, even after the parent function has closed. From w3 school a closure is a function that has an environment of its own. By wikipedia simple.wikipedia.org/wiki/Closure_(computer_programming)
Hi I am 3rd year student doing BTech from a tier 3 college. Currently I don't know anything about development and dsa. Don't know how to start,from where to start. If you can guide me It will be very helpful for me
@@ayaniegain DSA round keliye language important nahi hai bro ap jo bhi language se comfortable ho usise desakte ho only tumhara problem solving skill dikha jayega naaki programming language
bhai mere gandu se gandu dost log interview nikal liye aur kisiko ko kuch nhi aata tha aur ye deep copy shallow copy kb se bahi puch ne lage fresher se ha puchte hai pr package bhi 70000 ka rehta hai fir yaar thoda basic rkkhe kyunki market me job mil rahi 15000 ki aur ap ye sb bata rahee aur agar ye sb bata rahe to course bhi batate kaha se pade kyunki waha to bata rhe abc aur pauch rahe a2+b2=a3-b4 kaise hoga na bhai bhai aisa courese suggest krde kyunki jo ap puche hai bhai mere exprerience dost log answer nahi krparahe the to thoda bataaye.
Thank u sir, for giving me the opportunity to be interviewed❤
Waah bhai 🎉
From where did you learn JS ? You nailed it Bro ❤❤❤❤❤❤
@@thenextgyani6040 Namste Javascript , Chai aur Javascript, Blogs
@@thenextgyani6040Namste Javascript, Chai aur Javascript, Blogs
@@thenextgyani6040namaste javascript
maybe not applicable for every scenario but
function deepCopy(obj) {
return JSON.parse(JSON.stringify(obj));
}
Thank you so mach for this type of series. I solved last interview question that is infinite comments... And now going to solve this question 😊
whoa! just got the recommendation for your ep2 of this series and now ep3 came.
when i watched this interview my confidence comeback.... i like u r mock interview i learn many things from this video i will prepare very well.
Thanks for the support. New video bhi pasand ayegi vo bhi dekho ruclips.net/video/Rt392Oc2THs/видео.html
Reference MDN :-
A closure is the combination of a function bundled together (enclosed) with references to its surrounding state (the lexical environment). In other words, a closure gives a function access to its outer scope. In JavaScript, closures are created every time a function is created, at function creation time.
But it is not a function.
Keep it up my friend Ayush ❤
Previous interviews se bohot jyada easy tha
JSON.parse(JSON.stringify(object));
Solution of DeepCopy question
const ritikRuns={name:"Ritik",score:10,ball:{type:{subType:"leather"}}}
const otherRuns=deepCopy(ritikRuns)
otherRuns.ball.type.subType="tennis"
console.log(ritikRuns)
console.log(otherRuns)
function deepCopy(obj,createClone=true){
if(createClone)obj={...obj}
for(let key in obj){
if(typeof(obj[key])==="object"){
obj[key]=deepCopy(obj[key])
}
}
return {...obj}
}
Very nice. But bhai mujhe sirf 10 score Dia? Atleast century to krate
@@SemicolonGuy 😂😂 muje pata nahi tha bhaiya real name ritik hai apka warna definitely 💯 deta
@@08_tanmaybhansali2 hahahha
Keep it up bro❤
can you tell me how to prepare for react js internship
what type of questions i need to focus on?????????
// Define an outer function
function outerFunction(outerVariable) {
// Define an inner function (closure)
return function innerFunction(innerVariable) {
console.log('Outer Variable: ' + outerVariable);
console.log('Inner Variable: ' + innerVariable);
};
}
// Create a closure by calling outerFunction
const closureFunction = outerFunction('Hello');
// Check the type of closureFunction
console.log(typeof closureFunction); // "function"
// Invoke the closure
closureFunction('World');
// Output:
// Outer Variable: Hello
// Inner Variable: World
Conclusion: closure is a function is not a wrong statement .
From MDN, A closure is the combination of a function bundled together (enclosed) with references to its surrounding state (the lexical environment). In other words, a closure gives you access to an outer function's scope from an inner function. In JavaScript, closures are created every time a function is created, at function creation time.
Hence, closure is not a function. You are checking type of function, that's obviously not closure.
well answered by @binamralamsal
@@binamralamsal
A closure is a function having access to the parent scope, even after the parent function has closed. From w3 school
a closure is a function that has an environment of its own. By wikipedia
simple.wikipedia.org/wiki/Closure_(computer_programming)
Sir pls take my interview on Django. 😊❤
Please share mock interview link
Hi I am 3rd year student doing BTech from a tier 3 college. Currently I don't know anything about development and dsa. Don't know how to start,from where to start. If you can guide me It will be very helpful for me
frist lean tech stack and then learn dsa..you easily understand dsa.i suggest learn python, java and .not.. dont choose mern
linkedin par connect krke msg krdo. bhai : linkedin.com/in/ritikcodes
I also have same promblem can you guide me too ?
chatgtp use kar le bhai interview deke kya hi kar lega, khud interviewer ko itna knowledge nahi rehta hai,
Itna acha explains kr raha hai bhai sir ne phele se question dedy tha kya
Mujhe bhi esa hi lga tha. Bnda prepared tha
he is right closure is a function. you are wrong
And from where did you learn this?
@@SemicolonGuy w3schools and linkedin
@@SemicolonGuy from linkedin and w3schools.
@@SemicolonGuy Bro! Plz don't delete my comment again and again. I said linkedin and W3Schools
I love your channel and effort.
Wow, You are too good! :)
kon? mai ya phir candidate 😂
@@SemicolonGuy offcourse aap.
Sir interview pura english me hota hai ya hr pe depend krta hai hindi english both use kr skte hai?
depend krta interviewer kaha ka hai. Agar usko hindi aati to hinglish ho jata
Keep it up bro
Congratulations 👏 ayush 🎉🎉
Is there a DSA round in interviews? Which language do you prefer for problem solving?
Smjh nhi aya
@@SemicolonGuy Is there a DSA round in interviews? Which language do you prefer for problem solving?
@@ayaniegain DSA round keliye language important nahi hai bro ap jo bhi language se comfortable ho usise desakte ho only tumhara problem solving skill dikha jayega naaki programming language
Sir I'm doing Bsc and preparing for web development. are there any opportunity for bsc students.
Ha bhai, Where there’s a will, there’s a way.
Are bhai keyword ki to maar li 😂😂😂😂😂😂😂😂😂😂😂
First question is how nurvous are you?
Can you do little good acting while taking fake interview
fake interview?
I think i have done a good acting if you felt this interview a fake
@@SemicolonGuy ya but its worst. If i see such interviewer i will reject the job offer in first place
Waist kyu? What is wrong with this question?
Helpful👍
Glad it helped! Aur kya pasand kroge dekhna
lack of josh...
Itna late laaaye ho video kya balu
Tech burner ne ye interview kb diya 🤡
Jaha bhi tech hoga vaha tech burner to hoga hi 😝
Tech burner bhai yaha ky kar rhe 😆
Nya startup aane wala hai tech burner ka
bhai mere gandu se gandu dost log interview nikal liye aur kisiko ko kuch nhi aata tha aur ye deep copy shallow copy kb se bahi puch ne lage fresher se ha puchte hai pr package bhi 70000 ka rehta hai fir yaar thoda basic rkkhe kyunki market me job mil rahi 15000 ki aur ap ye sb bata rahee aur agar ye sb bata rahe to course bhi batate kaha se pade kyunki waha to bata rhe abc aur pauch rahe a2+b2=a3-b4 kaise hoga na bhai bhai aisa courese suggest krde kyunki jo ap puche hai bhai mere exprerience dost log answer nahi krparahe the to thoda bataaye.
ji semicolon bhai sahab course suggest kre kyun ki jo ldka bata raha wo experience log nahi bata paye
Feel you bro! Aajao LinkedIn par baat krte hai?
linkedin.com/in/ritikcodes
Ap c++ ka inter lete hoo sir
nhi bhai, aati hi nhi
mujhe bhi interview dena hi
LinkedIn par msg kro
cool nehi hai bhai 😑
Interviewer linkedin?
www.linkedin.com/in/unstoppableayush?
I need a mentor, sir can you please be my mentor 🙏
abhi to mai 1:1 mentorship nhi krta
Please take my interview #todospecial
please join our whatsapp group from description. You will find mock interview form there
J
What is j?
Ritik bhaiya ne muje dhoka de Diya warna me Aaj is video interview de Raha hota 😔😔😔
Who asked?
@@AdnanGamer745 tuje kisane bola reply ke liye chomu
Haha
@@Kamlesh20005 lmao you ain't getting hired with that attitude
@@TragicGFuelbruh why do you care 💀
const users={
name:"semiccolon",score:{
max:100
}
}
function deepCopy(users){
const obj={}
for(let i in users){
if(typeof users[i] !=='object'){
obj[i]=users[i]
}else{
obj[i]=deepCopy(users[i])
}
}
return obj
}
const user1=deepCopy(users)
user1.score.max=40
console.log(user1)
console.log(users)
can you tell me how to prepare for react js internship
what type of questions i need to focus on?????????
You can prepare for machine coding round and basic hooks, class and new react features question
@@SemicolonGuy you mean class based component??
Difference between class and function based. Why hooks were introduced. Just the basics