Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. 别人的思路 我还是太菜了! ...
分类:
其他好文 时间:
2016-08-21 22:44:25
阅读次数:
171
Write a function that takes a string as input and returns the string reversed. Example: Given s = "hello", return "olleh". 在这里介绍python中字符串翻转的几种方法: 1.步 ...
分类:
其他好文 时间:
2016-08-21 22:32:04
阅读次数:
162
js中的封闭空间主要是利用了给变量加括号结果不变。比如: var show=function(){ alert(1); } show(); 即使给show()变换成(show)(),结果是不变的。show本身代表的是(function(){alert(1)}),所以还可以写成匿名函数(functio ...
分类:
其他好文 时间:
2016-08-21 19:55:04
阅读次数:
173
一.基本概念 if you call me, i will call back 什么是回调函数 回调函数(callback Function),顾名思义,用于回调的函数。 回调函数只是一个功能片段,由用户按照回调函数调用约定来实现的一个函数。回调函数是一个工作流的一部分,由工作流来决定函数的调用(回 ...
分类:
其他好文 时间:
2016-08-21 19:47:44
阅读次数:
153
所谓的单例模式就是说一个对象,我们只去实例化一次,在页面中如果有一个对象是唯一的,那么就可以用单例模式。 var Fn = function(name){ this.name = name;}; Fn.prototype.getName = function(){ return this.name; ...
分类:
其他好文 时间:
2016-08-21 18:34:51
阅读次数:
106
<!DOCTYPE><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><title>导航条</title><script type="text/javascript">function ch ...
分类:
其他好文 时间:
2016-08-21 18:26:04
阅读次数:
131
比如在多个条件判断中,也许条件会被更改这样的话,我们又得重新写过,策略模式就是解决这个问题。 var get = { A:function(){ console.log('a'); }, B:function(){ console.log('b'); }}; var getAB = function ...
分类:
其他好文 时间:
2016-08-21 18:21:33
阅读次数:
107
函数:函数function是由若干条shell命令组成的语句块,实现代码重用和模块化编程1)函数的定义:可在命令行,脚本的一部分,只有函数的单独文件中定义两部分组成:函数名和函数体;函数体可带有返回状态值return#-语法一:functionf_name{...函数体...}-语法二:f_name(){...函..
分类:
系统相关 时间:
2016-08-21 16:59:26
阅读次数:
271
Python中使用线程有三种方式:
方法一:函数式
调用thread模块中的start_new_thread()函数来产生新线程。语法如下:
thread.start_new_thread ( function, args[, kwargs] )
参数说明:
function - 线程函数。
args - 传递给线程函数的参数,他必须是个tuple类型。
kwar...
分类:
编程语言 时间:
2016-08-21 16:55:15
阅读次数:
311
Mark 一下: $(document).keydown(function (e) { console.log(e); var keyCode = e.keyCode || e.which || e.charCode; var shiftKey = e.shiftKey; if (shiftKey ...
分类:
Web程序 时间:
2016-08-21 15:08:59
阅读次数:
219