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
如何把一个字符串,用特定的符号有序的连接,列出所有连接可能。 | |
如:'ab' -> a-b, | |
'abc' -> a-bc, a-b-c, ab-c, | |
'abcd' -> a-bcd, ab-cd, abc-d,a-b-cd, ab-c-d,a-bc-d,a-b-c-d | |
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
求一个字符串的字节长度; | |
//假设一个中文占两个字节 | |
/*var str = 'hello中国'; | |
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
用代码实现函数B继承函数A里边的全部属性与方法,且覆盖函数A其中的sayName方法。 | |
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
输入一个自然数 n,输出所有可能和为 n 连续正数序列。 | |
例如输入15,由于1+2+3+4+5=4+5+6=7+8=15, | |
所以输出 3 个连续序列1,2,3,4,5、4,5,6 和7,8。 | |
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
对一个数组进行排序:要求奇数在前偶数在后,奇数从大到小排列,偶数从小到大排列。 | |
如:var arr = [13,4,2,3,8,5,6,7]; -> arr = [13,7,5,3,2,4,6,8]; | |
输入一个自然数 n,输出所有可能和为 n 连续正数序列。 | |
例如输入15,由于1+2+3+4+5=4+5+6=7+8=15, | |
所以输出 3 个连续序列1,2,3,4,5、4,5,6 和7,8。 | |
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
将任意数字的金额,转换成汉字大写的形式。 | |
如:1234.50 -> 壹仟贰佰叁拾肆圆伍角。 | |
壹、贰、叁、肆、伍、陆、柒、捌、玖、拾、佰、仟、万、亿、元、角、分、零、整。 | |
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
用代码实现一个毫秒级的倒计时,且可以多处调用。 | |
格式如:离建群三周年还有: 30天-23小时-40分钟-58秒-32毫秒 | |
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
请把“[img111],[img222]”替换为“<img src="111.jpg"/>,<img src="222.jpg"/>”。 | |
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
如何获取URL地址栏参数? | |
如:https://gist.github.com/send.php?name=jikey&age=30&lan=js; | |
getParam(); -> { name : jikey, age : 30, lan : js} | |
getParam('name') -> jikey | |
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
我在向美女Mary索要QQ号时,她告诉我这样的规则: | |
首先将第1个数删除,紧接着将第2个数放到这串数的末尾, | |
再将第3个数删除并将第4个数放到这串数的末尾, | |
再将第5个数删除,一直到最后一个数,将最后的一个数也删除。 | |
按照刚才删除的顺序,把这些删除的数按顺序串连起来就是Mary的QQ号。 | |
比如这个qq号是:123456 删除后连起来的数是: | |
1 | |
34562 | |
3 | |
5624 |