首页 技术 正文
技术 2022年11月18日
0 收藏 874 点赞 5,147 浏览 1601 个字

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));
// ƒ 6function addBug(a){
function s(b){
a = a+b;
return s;
}
s.toString = function(){return a;}
return s;
}
console.log(addBug(1)(2)(3)(4));
// ƒ 10addBug(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 发布文章使用:只允许注册用户才可以访问!


相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,088
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,564
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,412
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,185
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,822
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,905