Daily-Interview-Question icon indicating copy to clipboard operation
Daily-Interview-Question copied to clipboard

我是依扬(木易杨),公众号「高级前端进阶」作者,每天搞定一道前端大厂面试题,祝大家天天进步,一年后会看到不一样的自己。

Results 160 Daily-Interview-Question issues
Sort by recently updated
recently updated
newest added

` Object.prototype.map = function(callback){ if(typeof callback !== "function"){ throw new TypeError("param must be a Function") } const newObj = {} for(const key in this){ if(this.hasOwnProperty(key)){ newObj[key] = callback(this[key],key,this) } }...

const fn = function(str){ let arr = str.split("") let obj = {} let maxStr = "", maxNum = 0; arr.reduce((pre, next) => { if(pre in obj){ if(pre == next) obj[pre]++...

鉴于十三题可以说的东西很多,就先看了十四题,作为一个单身狗,new的对象都是一个小狗啊 ``` // 实现一个new var Dog = function(name) { this.name = name } Dog.prototype.bark = function() { console.log('wangwang') } Dog.prototype.sayName = function() { console.log('my name is ' + this.name) }...

编程题

我使用Chrome打印为 ``` { "2": 1, "3": 2, "length": 4 } ``` 分析: 1. push 方法的行为: Array.prototype.push 方法根据对象的 length 属性决定插入位置。调用 push 时,元素会被添加到索引 length 处,并将 length 加 1。 2. 第一次 push(1): 初始...

const arr = [10, 21, 0, -7, 35, 7, 9, 23, 18] var pos = 0 var num = arr[0] for (var i = 1; i < arr.length; i++) {...

话不多说直接放代码 发现了比较多的错误,但由于最近工作有点忙,一直没来得及纠正 #### 更改(0226) ```javascript // 工具函数 let _toString = Object.prototype.toString let map = { array: 'Array', object: 'Object', function: 'Function', string: 'String', null: 'Null', undefined: 'Undefined', boolean: 'Boolean', number:...

编程题