Interview Task
1) What will the code below output to the console and why?
var myObject = {
foo: "bar",
func: function() {
var self = this;
[Link]("outer func: [Link] = " + [Link]);
[Link]("outer func: [Link] = " + [Link]);
(function() {
[Link]("inner func: [Link] = " + [Link]);
[Link]("inner func: [Link] = " + [Link]);
}());
};
[Link]();
2) The following recursive code will cause a stack overflow if the array list is too large. How can you fix
this and still retain the recursive pattern?
var list = readHugeList();
var nextListItem = function() {
var item = [Link]();
if (item) {
// process the list item...
nextListItem();
};
3) Build a simple slot machine game
Stack that you must use
1) JS or jQuery for the front end.
2) HTML & CSS
Note: Don’t use any plugins.