Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[面经]-[快手]-[电商]-[2020.03.30] #19

Open
L1116 opened this issue Mar 30, 2020 · 0 comments
Open

[面经]-[快手]-[电商]-[2020.03.30] #19

L1116 opened this issue Mar 30, 2020 · 0 comments
Labels

Comments

@L1116
Copy link
Collaborator

L1116 commented Mar 30, 2020

1.文字的颜色

<style>
	.classA{
        color:blue;
	}
	.classB{
        color:red;
	}
</style>
<p class="classB classA">123</p>

2.child的border,padding,盒子大小

<style>
    .parent {
      background: red;
      width: 100px;
      height: 100px;
      padding: 0;
      margin: 0;
    }

    .child {
      background: green;
      width: 50px;
      height: 50px;
      padding: 10%;
      border: 10px solid black;
      box-sizing: border-box;
    }
</style>
<div class="parent">
   <div class="child"></div>
</div>

  1. 代码的执行结果
Function.prototype.a = () => alert(1);
Object.prototype.b = () => alert(2);
function A() {}
const a = new A();
a.a();
a.b();
a.__proto__ = ?
A.prototype = ?

var x = 10;
function a(y) {
  var x = 20;
  return b(y);
}

function b(y) {
  return x + y
}

a(20);

console.log(1);

setTimeout(() => {
  console.log(2)
});

process.nextTick(() => {
  console.log(3);
});

setImmediate(() => {
  console.log(4)
});

new Promise(resolve => {
  console.log(5);
  resolve();
  console.log(6);
}).then(() => {
  console.log(7)
});

Promise.resolve().then(() => {
  console.log(8);
  process.nextTick(() => {
    console.log(9)
  });
});

6.数组随机洗牌,请实现一个算法,实现数组乱序,要求每个数字出现在每个位置的概率是平均的

function radomArr(arr){
   
    return arr.sort(compare)
}

function compare(){
         var x = Math.random()
        //console.log(x)
         var label = x > 0.5 ? 1 : -1
         return label
}


console.log(radomArr([1,2,3,4,5]))

  1. 实现add,one,two三个方法
function add() {
}

function one() {
}

function two() {
}

console.log(one(add(two())))
// 3
console.log(two(add(one())))
// 3

8 数字逆转,不可以使用数组或者字符串的reverse方法
123 -> 321
-56 -> -65
780 -> 87

@L1116 L1116 added the 面经 label Mar 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant