Open JaimeCheng opened 5 years ago
zxx: 本期要点
- 题目1,3测试见:http://quiz.xiliz.com/qunit39.html
- 常见错误算法:取范围的时候,依次取对应位数的范围,举例:'100' 和 '001' 之间范围的值,如果是错误算法,055是不可能取到的。而且'000'并不在范围之内,所以这是严重错误的算法。
- 常见错误2:没有补0,已经在代码那里备注了。
- HEX色值本质上是16进制的颜色表示方法。所以,如果我们要比对,可以转成10进制,如果要把数值变成HEX色值,直接转16进制就可以。JS自带很多方法,例如(200).toString(16) -> 'c8',注意前面补0,可以使用ES6 padStart()方法。
- 代码不精简没关系,算法小白也没关系,运行正确才是首位的。
题目: 原issue
回答:
满分回答
总结:
> 在线demo <