Interview
Interview copied to clipboard
我是追梦赤子心,公众号「深圳湾码农」的作者,某上市集团公司高级前端开发,深耕前端领域多年,每天攻破一道题,带你从0到1系统构建web全栈完整的知识体系!
要求: 1、只能修改 setTimeout 到 Math.floor(Math.random() * 1000 的代码 2、不能修改 Math.floor(Math.random() * 1000 3、不能使用全局变量 ``` function print(n){ setTimeout(() => { console.log(n); }, Math.floor(Math.random() * 1000)); } for(var i = 0; i...
``` const getAttribute = (object /*目标对象*/,attribute /*目标属性*/, defaultValue /*默认值*/) 示例: const obj = {a: {b: {c: 100}}, d:[{f: 'abc'}]}; getAttribute(obj, 'a.b.c', 0) === 100 getAttribute(obj, 'a.b.e', 'default') === 'default' getAttribute(obj,...
``` // 约定: // title数据类型为String // userId为主键,数据类型为Number var data = [ {userId: 8, title: 'title1'}, {userId: 11, title: 'other'}, {userId: 15, title: null}, {userId: 19, title: 'title2'} ]; var find...
例如:输入一个矩阵,按照从外向里以顺时针的顺序依次打印出每一个数字,例如,如果输入如下4 X 4矩阵: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 则依次打印出数字1,2,3,4,8,12,16,15,14,13,9,5,6,7,11,10。