Senior LinkedIn Frontend Interview

[hide=150]
Questions:

  1. Event Bubbling
  2. Prototype vs. Class
  3. Accessibility
  4. Callback vs. Promise

Code Writing:
// 1. Given the following class
var Foo = function (a) {
this.a = a;
this.bar = function() {
return this.a;
}
this.baz = function () {
return this.a;
};
};

Foo.prototype = {
biz: function () {
return this.a;
}
};

var f = new Foo(7);
// Write the results
f.bar();
f.baz();
f.biz();

// ------------------------------------------
// 2. Write a memoization function
function memoize(fn) {
// todo
}

// Usage
function fib(n) {
// fibonacci
return n;
}

fib(n);
var memoizedFib = memoize(fib);

memoizedFib(n);

// -----------------------------------
//3. Implement Infinity Scroll

/**

  • API Docs

  • /posts?page=0 => [{id: 1, title: ‘Post 1’}, {id: 2, title: ‘Post 2’}, {id: 3, title: ‘Post 3’}, N…]
  • /posts?page=1 => [{id: 4, title: ‘Post 4’}, {id: 5, title: ‘Post 5’}, {id: 6, title: ‘Post 6’}, N…]
  • /posts?page=N => [N…]
    */

// HTML
// ---------

    // JS
    // ---------
    $(window).on(‘scroll’, scrollHandler);

    function scrollHandler() {
    //todo
    }
    [/hide=150]