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 发布文章使用:只允许注册用户才可以访问!
Front-end Job Interview Questions的更多相关文章
- WCF学习系列二---【WCF Interview Questions – Part 2 翻译系列】
http://www.topwcftutorials.net/2012/09/wcf-faqs-part2.html WCF Interview Questions – Part 2 This WCF ...
- [译]Node.js Interview Questions and Answers (2017 Edition)
原文 Node.js Interview Questions for 2017 什么是error-first callback? 如何避免无止境的callback? 什么是Promises? 用什么工 ...
- WCF学习系列三--【WCF Interview Questions – Part 3 翻译系列】
http://www.topwcftutorials.net/2012/10/wcf-faqs-part3.html WCF Interview Questions – Part 3 This WCF ...
- WCF学习系列四--【WCF Interview Questions – Part 4 翻译系列】
WCF Interview Questions – Part 4 This WCF service tutorial is part-4 in series of WCF Interview Qu ...
- [转]Design Pattern Interview Questions - Part 4
Bridge Pattern, Composite Pattern, Decorator Pattern, Facade Pattern, COR Pattern, Proxy Pattern, te ...
- [转]Design Pattern Interview Questions - Part 2
Interpeter , Iterator , Mediator , Memento and Observer design patterns. (I) what is Interpreter pat ...
- [转]Design Pattern Interview Questions - Part 3
State, Stratergy, Visitor Adapter and fly weight design pattern from interview perspective. (I) Can ...
- [转]Design Pattern Interview Questions - Part 1
Factory, Abstract factory, prototype pattern (B) What are design patterns? (A) Can you explain facto ...
- 101+ Manual and Automation Software Testing Interview Questions and Answers
101+ Manual and Automation Software Testing Interview Questions and Answers http://www.softwaretesti ...
- 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 ...
随机推荐
- ClickHouse最简单的安装方法
安装包地址: https://packagecloud.io/Altinity/clickhouse 无需下载安装包,更新yum源即可!! 最后: yum install -y clickhouse- ...
- 水题:P2799 国王的魔镜
思路:简单模拟即可.判断一下是不是回文,是回文看长度是不是偶数.是偶数的话,说明又可能是回文.依次这样处理.但是只要长度为奇数则一定是原来的长度直接输出即可. #include<iostream ...
- ssm框架的整合搭建(二)
maven简单项目的创建前面已经完成了,下面开始依赖包和配置文件的编写 好好努力每一天!!!!!! 项目结构看这里 1.首先,依赖包pom.xml <project xmlns="ht ...
- layui之日期和时间组件
参考文档:https://www.layui.com/doc/modules/laydate.html代码片段如下: layui.use('laydate', function(){ var layd ...
- 【vue】css解决“防抖动”——防止页面加载图片抖动
overflow:hidden;height:0;padding-bottom:*; // 其中*处填 图片的高宽百分比=高/宽*100%
- mongodb .explain('executionStats') 查询性能分析(转)
mongodb性能分析方法:explain() 为了演示的效果,我们先来创建一个有200万个文档的记录.(我自己的电脑耗了15分钟左右插入完成.如果你想插更多的文档也没问题,只要有耐心等就可以了.) ...
- Scala学习(九)---文件和正则表达式
文件和正则表达式 摘要: 在本篇中,你将学习如何执行常用的文件处理任务,比如从文件中读取所有行或单词,或者读取包含数字的文件等.本篇的要点包括: 1. Source.fromFile(...).get ...
- Linux每天一个命令:grep
grep (缩写来自Globally search a Regular Expression and Print) 是一种强大的文本搜索工具,它能使用特定模式匹配(包括正则表达式)搜索文本,并默认输出 ...
- LeetCode 905. Sort Array By Parity
905. Sort Array By Parity Given an array A of non-negative integers, return an array consisting of a ...
- HDU - 1166 - 敌兵布阵 线段树的单点修改,区间求和
#include<iostream> #include<stdio.h> #include<string.h> #include<algorithm> ...