当前位置:网站首页>Interview question 1
Interview question 1
2022-07-01 19:46:00 【Wang yuanrou】
Wang yuanrou ==> Personal home page
| Come on, everybody , I like to break knowledge into small knowledge points by columns , Just say a piece of knowledge , Therefore, each article is short , I hope you don't mind . If necessary, you can check the column to see if there are articles to explain the knowledge points involved in this article , If you think it helps , I hope you will support me for the third time in a row . |
Recommended reading
Article structure
The origin of things
Last night, after dinner with female ticket , Go and send something to her best friend , After arriving at her best friend's house , My girl ticket and her best friend are chatting here and there , I'm bored , If I can't get in . Then he clicked on QQ Study Group , I just saw a group of friends send out the interview questions for his interview . as follows

I'll open it , The second question is OK , But I'm outside. I don't have a computer , Then he said

Well, help people to the end , I sent him the article I wrote about the third question
Section oriented programming AOP
follow-up 10 Come home at more than ten , Turn on the computer and answer it
The second question is
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));


Third question
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");


Conclusion
Just learned this knowledge , So just review and share , Let's learn together. Come on , The next step is to find a job in Balabala in the Group , I got something on the way csdn Two concerns , Ha ha ha .
The end! !
边栏推荐
- Collation of open source protocols of open source frameworks commonly used in Web Development
- torch. nn. functional. Interpolate function
- How to correctly use vertx to operate redis (3.9.4 with source code analysis)
- GC垃圾回收
- Analysis of GetMessage underlying mechanism
- MySQl的基本使用
- uni-app商品分类
- 事务隔离级别 gap锁 死锁
- 解决VSCode下载慢或下载失败的问题
- [SQL optimization] the difference between with as and temporary tables
猜你喜欢
随机推荐
How to add transactions in JDBC
Image acquisition and playback of coaxpress high speed camera based on pxie interface
Procédure de mesure du capteur d'accord vibrant par le module d'acquisition d'accord vibrant
JS ternary expression complex condition judgment
对象的创建
H264编码profile & level控制
一个程序员如何快速成长
Analysis of GetMessage underlying mechanism
Time series analysis using kibana timelion
The key to the success of digital transformation enterprises is to create value with data
自定义插入页面标签以及实现类似通讯录的首字母搜索
[Mori city] random talk on GIS data (I)
[exercise] HashSet
Salesmartly has some tricks for Facebook chat!
毕业季 | 华为专家亲授面试秘诀:如何拿到大厂高薪offer?
servlet知识点
新增订单如何防止重复提交
【无标题】
After studying 11 kinds of real-time chat software, I found that they all have these functions
optaplanner学习笔记(一)案例Cloud balance









