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
// 感谢深圳[时空]贡献 腾讯面试题一枚 | |
f = function() {return true;}; | |
g = function() {return false;}; | |
(function() { | |
if (g() && [] == ![]) { | |
f = function f() {return false;}; | |
function g() {return true;} | |
} | |
})(); |
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
根据系统日期,输出这一天是这一年的第多少天,第多少星期,是否为闰月? | |
比如日期为:2014-07-21 | |
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
请把一组有规律的单词拼接起来,规则为: | |
前一个单词的结尾应该与下一个单词的首字母相同。 | |
如: aloha, dog, arachnid, gopher, tiger, rat | |
结果为:aloha-arachnid-dog-gopher-rat-tiger. | |
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
有这样一个需求,页面上有连续的li若干个,然后不间断的用ul去包裹,如何实现。 | |
比如,有50个li,1-5个包一个ul,6-12包一个ul,13-30个包一个,31-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
找出以下2个数组中相同数的最大一个数 | |
比如: | |
var A = [1,3,4,5,6,7,8,9]; | |
var B = [12,10,9,8,7,1]; | |
相同的有: | |
1,7,8,9 | |
那最大的一个数就是9。 | |
PS: |
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
请说出以下的区别: | |
1. $.get(), $.post() | |
2. closest, parent, parents, parentsUtil, offsetParent | |
3. offset, position, | |
4. find, children, filter, siblings | |
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
请说出以下的区别: | |
1. $, $.fn | |
尤其是在写插件的时候? | |
$.fn.hilight = function( options ){}; | |
$.hilight = function( options ){}; | |
2. on,bind,live,delegate | |
3. 为什么要使用命名空间来绑定事件 | |
$().on('click.myEvent',fn) | |
4. $().animate()能控制css中所有的属性实现动画? |
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
请说出以下的区别: | |
1. $('p').get(), | |
2. $('p')[1], | |
3. $('p').eq(0), | |
4. $('p').index() | |
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
输出一个用"A"拼凑而成的心形。 | |
AAA AAA | |
AAAAA AAAAA | |
AAAAAAAAAAAAA | |
AAAAAAAAAAA | |
AAAAAAAAA | |
AAAAAAA | |
AAAAA | |
AAA |
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
用速度最优的代码输出一个用"A"拼凑而成的平行四边形。 | |
A | |
AAA | |
AAAAA | |
AAAAAAA | |
AAAAAAAAA | |
AAAAAAA | |
AAAAA | |
AAA | |
A |