Front-end Job Interview Questions
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
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/10569997.html
未经授权禁止转载,违者必究!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· .NET10 - 预览版1新功能体验(一)