当前位置:网站首页>面试题篇一
面试题篇一
2022-07-01 18:46:00 【王元肉】
| 大家一起加油,我喜欢分专栏将知识打碎成一份一份小知识点,一篇文章只说一个知识点,因此每篇文章篇幅较短,希望大家不要介意。如有需要可以查看专栏看看是否有该文章中涉及到的知识点进行讲解的文章,如果大家觉得有帮助,希望大家三连支持一下。 |
推荐阅读
事情起源
昨天晚上和女票吃完晚饭后,去给她闺蜜送点东西,到她闺蜜家后,我女票和她闺蜜在那聊这聊那,我无聊啊,我插不进去话。然后点开了QQ学习群,刚好看见一个群友发出了他面试的面试题。如下

我点开一看,第二题还行,但是我在外面啊没有电脑,然后他又说

好吧帮人帮到底,我给他发了关于第三题我写的文章
后续10点多回到家,赶紧打开电脑为其解答
第二题
const adjoin = function(arr, callback) {
let result = [];
let bridge = [];
arr.forEach(function(item) {
callback(item) ?
bridge.push(item) : (() => {
bridge.length > 0 ? result.push(bridge) : null;
result.push(item);
bridge = [];
})()
})
if (bridge.length > 0) result.push(bridge);
return result;
}
console.log(adjoin([1, 2, 3, 4, 5], item => item !== 3));
console.log(adjoin([1, 2, 3, 4], item => item < 3));


第三题
Function.prototype.eatFirst = function(msg) {
const _this = this;
return function() {
(function() {
console.log(`Eat ${
msg}~`);
})(...arguments)
_this.call(this, ...arguments);
};
};
Function.prototype.eat = function(msg) {
const _this = this;
return function() {
_this.call(this, ...arguments);
(function() {
console.log(`Eat ${
msg}~`);
})(...arguments)
};
};
function ManBehavior(msg) {
console.log(`Hi This is ${
msg}!`);
}
ManBehavior.call(ManBehavior, "Hank");
console.log("-------------");
ManBehavior.eat("dinner").eat("supper").call(ManBehavior, "Hank");
console.log("-------------");
ManBehavior.eat("dinner").eatFirst("lunch").call(ManBehavior, "Hank");
console.log("-------------");
ManBehavior
.eat("dinner")
.eatFirst("lunch")
.eatFirst("breakfast")
.call(ManBehavior, "Hank");


结语
刚好学过这个知识,所以刚好复习并分享出来,大家一起学习加油,后续就是在群里巴拉巴拉找工作的事情,中途还收获了csdn两关注,哈哈哈。
结束啦!
边栏推荐
猜你喜欢

Why must we move from Devops to bizdevops?

GC垃圾回收

P2433 【深基1-2】小学数学 N 合一

What is the essential difference between Bi development and report development?

类加载机制

Introduction to relevant processes and functions of wechat official account development

Salesmartly has some tricks for Facebook chat!

Crunch简介、安装,使用Crunch制作密码字典

Audio and video, encoding and decoding related e-books, gadgets, packaged for free!

【无标题】
随机推荐
ffmpeg常用命令(二)
Brpc understanding
A brief understanding of white box encryption technology
[untitled]
js三元表达式复杂条件判断
Simplified pinduoduo product data
ffmpeg 错误码
OpenCV视频质量诊断----视频遮挡诊断
Difference between redo and undo
Actual combat of flutter - fast implementation of audio and video call application
Interview questions for audio and video positions in Dachang -- today's headline
After studying 11 kinds of real-time chat software, I found that they all have these functions
Time series analysis using kibana timelion
Remove line breaks from MySQL query results
商业智能BI开发和报表开发有什么本质区别?
Introduction to relevant processes and functions of wechat official account development
自定义插入页面标签以及实现类似通讯录的首字母搜索
Optimization of video streaming with repeated requests in the case of unstable easygbs network
PowerDesigner设计Name和Comment 替换
GetMessage底层机制分析