This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
如何给一个长度一定的数字补0. | |
比如:1,需要长度是5位,那么是 00001。 | |
23,需要长度是5位,那么是 00023。 | |
234,需要长度是5位,那么是 00234。 | |
PS: | |
1. 回复时注意加上下面这句话,才会有语法高亮或格式缩进。 | |
```javascript | |
// you code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Angular; Backbone; Console; Dir; Express; | |
Fork; Grunt; Haslayout; Iconfont; | |
Jsonp; Kissy; Localstorage; Media query; | |
Npm; Opacity; Prototype; Querystring; | |
Referer; Seajs; Trim; Underscore; Vim; | |
Worker; Xss; Yslow; Zepto; | |
请用最简短的描述说出以上26个字母的相关含义。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
请问JS怎么判断中文,数字,字母? | |
PS: | |
1. 回复时注意加上下面这句话,才会有语法高亮或格式缩进。 | |
```javascript | |
// you code | |
``` | |
2. 粘贴代码时请使用shift+tab,缩进前面的空白。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
给出一个数,求最接近此数的2的幂。 | |
比如1最接近的数是1 | |
比如2最接近的数是2 | |
比如5最接近的数是8。 | |
PS: | |
1. 回复时注意加上下面这句话,才会有语法高亮或格式缩进。 | |
```javascript | |
// you code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 感谢[广州—坚壳]贡献 | |
编码字符串,要求能解码,且只能编码为字母和数字, | |
要求得到最短的编码长度。 | |
如: | |
setcode('你好a') -> ‘232abc'; | |
getcode('232abc') -> '你好a' | |
PS: | |
1. 回复时注意加上下面这句话,才会有语法高亮或格式缩进。 | |
```javascript |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
输出在一个范围内,所有2进制位为1的数。 | |
比如: | |
[0,2] -> 1 对应2进制 (1) | |
[1,3] -> 1,3 对应2进制 (1, 11) | |
[2,5] -> 3 对应2进制 (11) | |
PS: | |
1. 回复时注意加上下面这句话,才会有语法高亮或格式缩进。 | |
```javascript |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
琴琴是一个具备高情商与高智商"双重杀手",她想根据注册时间较早车牌的的车, | |
来陪她一块去海边看日出。经过研究发现,车牌也是按序列发放, | |
由5个字母或数字组成,每个位排序是按字母数字的ASCII的先后位置, | |
比如:0o4r4 > ye6er ,0的ASCII是48,y的ASCII是121。所以0o4r4是较早的, | |
如果第一位相同,则判断第2位。实现这个程序。 | |
PS: | |
1. 回复时注意加上下面这句话,才会有语法高亮或格式缩进。 | |
```javascript |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
数组arr1和arr2,长度都不固定,如何从arr1中删除和arr2中重复值的元素。 | |
如:var arr1 = [1,3,4,6,7]; | |
var arr2 = [3,4,7]; | |
===> | |
var arr3 = [1,6] | |
PS: | |
1. 回复时注意加上下面这句话,才会有语法高亮或格式缩进。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 感谢[广州—坚壳]贡献 | |
实现一个方法,使其达到如下的输出结果,比如: | |
fn(2); ==> 2; | |
fn(2)(3); ==> 6; | |
fn(2)(3)(3); ==> 18; | |
PS: | |
1. 回复时注意加上下面这句话,才会有语法高亮或格式缩进。 | |
```javascript |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
如何给数字补充固定位数前导0? | |
比如3前面补3位0,结果为0003。 | |
4前面补2位0,结果为004。 | |
PS: | |
1. 回复时注意加上下面这句话,才会有语法高亮或格式缩进。 | |
```javascript | |
// you code | |
``` |