• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

nathansmith/javascript-quiz: Front-End Developer tech screen quiz

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

nathansmith/javascript-quiz

开源软件地址:

https://github.com/nathansmith/javascript-quiz

开源编程语言:


开源软件介绍:

JavaScript Quiz

Note:

The purpose of this quiz isn't to be a brain-buster. It is meant for recruiters to present to front-end developer candidates.

The intent is to weed out some "Just use jQuery" applicants, but allow those that know JavaScript to pass fairly easily.

Intro Questions

  1. When might comparative type coercion occur? How would you avoid it? How would you change a "falsy" or "truthy" value into a real boolean?

  2. Describe how variable scope works. Explain how to create a closure using a self-executing anonymous function (also called IIFE: immediately-invoked function expression).

  3. Explain briefly how prototypal inheritance differs from class-based, "classical" inheritance.

  4. Describe how the "module pattern" works. Explain how the "revealing module pattern" expands upon it.

  5. How does a client-side MVC (or MVVM) approach work? What is your preferred MV* JS framework?

Additional Questions

  1. Why do these yield different results?

    '1' + 2 +  3 ; // Equals '123'
     3  + 2 + '1'; // Equals '51'
     3  + 2 +  1 ; // Equals 6
  2. Why is 0.3 not the result of the following addition? How do you work around this peculiarity?

    0.1 + 0.2; // Equals 0.30000000000000004
  3. Describe how variable hoisting works, and how to avoid bugs that may arise from it.

  4. How do these differ?

    function foo() {}
    
    // versus
    
    var foo = function() {};
  5. When might you use a function's call() method, or its apply() method?

  6. Explain how to determine if a variable is an array or an object. (Hint: typeof lies!)

  7. In the following example, what is foo aliased to? (Hint: It is what this means.)

    (function(foo) {
      // What is 'foo' aliased to?
    })(this);
  8. In JavaScript (and the DOM), some global variables are actually mutable, such as: window, document, and undefined. How would you write code to ensure these were predictably available for use? Assuming someone had injected this code, how would you work around it? (Hint: See the previous question.)

    var window = '';
    var document = 0;
    var undefined = true;
  9. In one line of code, how you would make a copy of an array?

  10. What is the difference between setInterval and setTimeout? Bonus: What is the lowest cross-browser increment that each can accurately use?

  11. Explain how delete works. What types of things cannot be deleted?

  12. Describe how event delegation works, and when you should use it to handle UI interaction. Example markup…

    <ul id="special">
      <li>
        <a href="#">Special link 1</a>
      </li>
      <li>
        <a href="#">Special link 2</a>
      </li>
      <li>
        <a href="#">Special link 3</a>
      </li>
    </ul>
  13. What does this snippet of code do?

    var foo = bar ? bar : 0;
  14. When might you write something like this, and what is it shorthand for?

    foo && foo.bar();
  15. How do parseInt and parseFloat differ? When would you use a number's toFixed() method? In what instance might the following code snippet actually make sense to use?

    var my_number = my_string - 0;
  16. Write a function named sum that returns the total of any number of parameters. Example…

    // Should equal 15
    sum(1, 2, 3, 4, 5);
    
    // Should equal 0
    sum(5, null, -5);
    
    // Should equal 10
    sum('1.0', false, 1, true, 1, 'A', 1, 'B', 1, 'C', 1, 'D', 1, 'E', 1, 'F', 1, 'G', 1);
    
    // Should equal 0.3, not 0.30000000000000004
    sum(0.1, 0.2);

BONUS Question

When the following code is pasted into a browser's console, what does it output?

(function(window) {

  var hello = 'Hello World';

  var arr = [
    '\x21',
    '\x6E',
    '\x61',
    '\x6D',
    '\x74',
    '\x61',
    '\x42'
  ];

  var str = '';
  var i = 16;

  while (i--) {
    str += 1 * hello;
    str += i % 2 === 0 ? '\x2C\x20' : '';
  }

  str = str.replace(/\x4E+/g, '\x6E');
  str = str.replace(/\x6E\x2C/g, '\x2C');
  str = str.slice(0, 1).toUpperCase() + str.slice(1, str.length);

  str += arr.reverse().join('');

  window.console.log(str);

})(this);



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
paolocarrasco/javascript-style-guide: Guía de Estilo para programar con JavaScr ...发布时间:2022-06-24
下一篇:
ym1623/javascript: javascript发布时间:2022-06-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap