Front-end Job Interview Questions

前端面试

https://github.com/h5bp/Front-end-Developer-Interview-Questions

https://github.com/MaximAbramchuck/awesome-interview-questions

https://thatjsdude.com/interview/index.html

http://caibaojian.com/fedbook/practice/front-end-interview.html


柯里化函数


function curry(fn) {
var slice = [].slice;
var len = fn.length; return function curried() {
var args = slice.call(arguments);
if (args.length >= len) {
return fn.apply(null, args);
} return function () {
return curried.apply(null, args.concat(slice.call(arguments)));
};
};
} var add = curry(function (a, b, c, d) {
return a + b + c + d;
}); console.log(add(1)(2)(3)(4)); // 10
console.log(add(1, 2, 3)(4)); // 10
console.log(add(1)(2, 3)(4)); // 10

https://segmentfault.com/q/1010000004342477

add(2)(5); // 7 & 柯里化 curry

js 实现, 函数 add(1)(2)(3); 无限极累加


"use strict"; /**
*
* @author xgqfrms
* @license MIT
* @copyright xgqfrms
* @created 2019-01-01
*
* @description add & curry
* @augments
* @example
*
*/ function add( seed ) {
function retVal( later ) {
return add( seed + later );
}
retVal.toString = function() {
return seed;
};
return retVal;
}
console.log(add(1)(2)(3).toString());
// 6
console.log(add(1)(2)(3));
// ƒ 6 function addBug(a){
function s(b){
a = a+b;
return s;
}
s.toString = function(){return a;}
return s;
}
console.log(addBug(1)(2)(3)(4));
// ƒ 10 addBug(1);
// ƒ 1
let x = addBug(1)(2);
// ƒ 3
x;
// ƒ 3
alert(addBug(1)(2)(3)(4));
// alert: 10
// true

refs

https://llh911001.gitbooks.io/mostly-adequate-guide-chinese/content/ch4.html

https://www.cnblogs.com/pengchen/p/5434705.html

https://www.cnblogs.com/oxspirt/p/5436629.html

https://www.ruanyifeng.com/blog/2015/02/flexible-javascript.html

wat

https://www.destroyallsoftware.com/talks/wat



&copyxgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


Front-end Job Interview Questions的更多相关文章

  1. WCF学习系列二---【WCF Interview Questions – Part 2 翻译系列】

    http://www.topwcftutorials.net/2012/09/wcf-faqs-part2.html WCF Interview Questions – Part 2 This WCF ...

  2. [译]Node.js Interview Questions and Answers (2017 Edition)

    原文 Node.js Interview Questions for 2017 什么是error-first callback? 如何避免无止境的callback? 什么是Promises? 用什么工 ...

  3. WCF学习系列三--【WCF Interview Questions – Part 3 翻译系列】

    http://www.topwcftutorials.net/2012/10/wcf-faqs-part3.html WCF Interview Questions – Part 3 This WCF ...

  4. WCF学习系列四--【WCF Interview Questions – Part 4 翻译系列】

    WCF Interview Questions – Part 4   This WCF service tutorial is part-4 in series of WCF Interview Qu ...

  5. [转]Design Pattern Interview Questions - Part 4

    Bridge Pattern, Composite Pattern, Decorator Pattern, Facade Pattern, COR Pattern, Proxy Pattern, te ...

  6. [转]Design Pattern Interview Questions - Part 2

    Interpeter , Iterator , Mediator , Memento and Observer design patterns. (I) what is Interpreter pat ...

  7. [转]Design Pattern Interview Questions - Part 3

    State, Stratergy, Visitor Adapter and fly weight design pattern from interview perspective. (I) Can ...

  8. [转]Design Pattern Interview Questions - Part 1

    Factory, Abstract factory, prototype pattern (B) What are design patterns? (A) Can you explain facto ...

  9. 101+ Manual and Automation Software Testing Interview Questions and Answers

    101+ Manual and Automation Software Testing Interview Questions and Answers http://www.softwaretesti ...

  10. 115 Java Interview Questions and Answers – The ULTIMATE List--reference

    In this tutorial we will discuss about different types of questions that can be used in a Java inter ...

随机推荐

  1. Oracle的条件in中包含NULL时的处理

    我们在写SQL时经常会用到in条件,如果in包含的值都是非NULL值,那么没有特殊的,但是如果in中的值包含null值(比如in后面跟一个子查询,子查询返回的结果有NULL值),Oracle又会怎么处 ...

  2. Python框架学习之Flask中的常用扩展包

    Flask框架是一个扩展性非常强的框架,所以导致它有非常多的扩展包.这些扩展包的功能都很强大.本节主要汇总一些常用的扩展包. 一. Flask-Script pip install flask-scr ...

  3. (admin.E108) The value of 'list_display[4]'报错解决方案

    参考资料:虫师-<web接口开发与自动化测试:基于python语言> 日常学习Django框架中,创建了用户模型,但是页面功能验证时候,提示不能进行列表字段操作,debug好久,才找到问题 ...

  4. 生成ssh公钥

    部分内容参考:http://git.mydoc.io/?t=154712 1.在电脑桌面上右键,选择git Base here 2.生成ssh公钥 ssh-keygen -t rsa -C" ...

  5. My ajaxwrapper tool

    Until recently, when I write ajax call, always write like below: $.ajax({ type: "post", da ...

  6. 性能调优8:分组聚合 - group by

    聚合实际上对数据做分组统计,SQL Server使用两种操作符来实现聚合,流聚合(Stream Aggregation)和哈希聚合(Hash aggration).流聚合是非阻塞性的,具有流的特性,流 ...

  7. JWT认证原理及使用

    一.JWT原理: 参考文章:https://www.jianshu.com/p/180a870a308a 1.传统的登录方式: 浏览器输入用户名密码,服务端校验通过,根据用户信息生成一个token,将 ...

  8. javaMail发邮件,激活用户账号

    用javamail实现注册用户验证邮箱功能.用户注册后随机生成一个uuid作为用户的标识,传递给用户然后作为路径参数.发送html的内容到用户注册的邮箱里,若用户点击后去往的页面提交username和 ...

  9. 埋锅。。。BZOJ1004-置换群+burnside定理+

    看这道题时当时觉得懵逼...这玩意完全看不懂啊...什么burnside...难受... 于是去看了点视频和资料,大概懂了置换群和burnside定理,亦步亦趋的懂了别人的代码,然后慢慢的打了出来.. ...

  10. hdu1201,hdu6252差分约束系统

    差分约束系统一般用来解决a-b>=c的问题,有n个这样的限制条件,求出某个满足这些条件的解 可以将这个问题转化成最长路问题,即b到a的距离最少为c,而有多条b到a的路的话,我们就取最长的b到a的 ...