Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JavaScript questions #92

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ __________________
18. How could you cache execution of any function?
19. If you need to implement the following chaining with call back, how will you implement it?
20. How could you implement moveLeft animation?
21. How would you implement currying for any functions?
21. How would you implement currying for any functions?
22. What is IIFEs (Immediately Invoked Function Expressions)?

#### [JS: Answer for Basics and Tricky Questions](http://www.thatjsdude.com/interview/js2.html)

Expand Down
15 changes: 14 additions & 1 deletion js2.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ <h4>List of Questions</h4>
<li><a href="#chianing">If you need to implement the following chaining with call back, how will you implement it?</a></li>
<li><a href="#animation">How could you implement moveLeft animation?</a></li>
<li><a href="#currying">How would you implement currying for any functions?</a></li>
<li><a href="#IIFEs">What is IIFEs (Immediately Invoked Function Expressions)?</a></li>
</ol>
</div>
<!-- <p class="gray">if you are little more comfortable or claim to be comfortable with javascript, these questions would not be enough for you. more coming</p>-->
Expand Down Expand Up @@ -740,7 +741,19 @@ <h2>21. Currying</h2>
kgToLb(3); //result here
</code></pre>
<p>ref: <a href="http://fr.umio.us/favoring-curry/">Favoring Curry</a>, <a href="http://javascriptweblog.wordpress.com/2010/04/05/curry-cooking-up-tastier-functions/">curry: cooking up tastier functions</a></p>
</div>
</div>
<div id="IIFEs">
<h2>22.IIFEs</h2>
<p><strong>Question: </strong>What is IIFEs (Immediately Invoked Function Expressions)?</p>
<p><strong>Answer:</strong>It’s an Immediately-Invoked Function Expression, or IIFE for short. It executes immediately after it’s created:</p>
<pre><code>
(function IIFE(){
console.log( "Hello!" );
})();
// "Hello!"
</code></pre>
<p>This pattern is often used when trying to avoid polluting the global namespace, because all the variables used inside the IIFE (like in any other normal function) are not visible outside its scope.</p>
</div>
<div>
<h3>Deleted Questions</h3>
<ul>
Expand Down