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. 【移动端】移动端字体单位font-size选择px还是rem

    对于只需要适配少部分手机设备,且分辨率对页面影响不大的,使用px即可对于需要适配各种移动设备,使用rem,例如只需要适配iphone和iPad等分辨率差别比较挺大的设备 html{font-size: ...

  2. 手动安装 Eclipse 插件 Viplugin

    对 Vimer 来说,切换到 Eclipse 环境,传统的码code方式明显降低效率,Viplugin 是一款类 Vi 模拟器,能实现 Vi 的基本编辑功能. 安装方法 (适用于Windows 和 L ...

  3. Python脱产8期 Day08 2019/4/22

    一.三种字符串 1.普通字符串:u'以字符作为输出单位‘  #print(u‘abc’)#用于显示 2.二进制字符串:b'以字节作为输出单位’#用于传输 3.原义字符串:r‘以字符作为输出单位,原样输 ...

  4. WPF(一)

    什么是WPF WPF(Windows Presentation Foundation)是用于Windows的现代图形显示系统.与之前出现的技术相比,WPF发生了根本性变化.WPF引用了"内置 ...

  5. 负载(Load)分析及问题排查

    平常的工作中,在衡量服务器的性能时,经常会涉及到几个指标,load.cpu.mem.qps.rt等.每个指标都有其独特的意义,很多时候在线上出现问题时,往往会伴随着某些指标的异常.大部分情况下,在问题 ...

  6. [LOJ#2386]. 「USACO 2018.01 Platinum」Cow at Large[点分治]

    题意 题目链接 分析 假设当前的根为 rt ,我们能够在奶牛到达 \(u\) 之时拦住它,当且仅当到叶子节点到 \(u\) 的最短距离 \(mn_u \le dis_u\) .容易发现,合法的区域是许 ...

  7. 写了个限制文本框输入最大长度的jquery插件 - jquery.restrictFieldLength.js

    做了个限制文本框最大输入长度的jquery插件,效果图(共2个文本框,限制最多10个字符): 功能:当超出设置的最大字符长度后,会截断字符串.更改当前元素的css(会在1秒后还原css).支持长度超出 ...

  8. ProxySQL+Mysql实现数据库读写分离实战

    ProxySQL介绍 ProxySQL是一个高性能的MySQL中间件,拥有强大的规则引擎.具有以下特性:http://www.proxysql.com/ 1.连接池,而且是multiplexing 2 ...

  9. 2019 年起如何开始学习 ABP 框架系列文章-开篇有益

    2019 年起如何开始学习 ABP 框架系列文章-开篇有益 [[TOC]] 本系列文章推荐阅读地址为:52ABP 开发文档 https://www.52abp.com/Wiki/52abp/lates ...

  10. functools下的partial模块应用

    问题 你有一个被其他python代码使用的callable对象,可能是一个回调函数或者是一个处理器, 但是它的参数太多了,导致调用时出错. 解决方案 如果需要减少某个函数的参数个数,你可以使用 fun ...