1.函数声明 function sum1(n1,n2){ return n1+n2; }; 2.函数表达式,又叫函数字面量 var sum2=function(n1,n2){ return n1+n2; }; 两者的区别:解析器会先读取函数声明,并使其在执行任何代码之前可以访问;而函数表达式则必须等 ...
分类:
其他好文 时间:
2016-09-20 10:31:37
阅读次数:
142
静态属性与方法可以在不实例化类的情况下调用,直接使用类名::方法名的方式进行调用。静态属性不允许对象使用->操作符调用。 class Car { private static $speed = 10; public static function getSpeed() { return self:: ...
分类:
Web程序 时间:
2016-09-20 10:16:17
阅读次数:
155
Curry化是一个转换过程,即我们执行函数的转换过程. function fn(x,y){ if(typeof y=="undefined"){ return function(y){ return x+y; } } return x+y; } console.log(fn(10,5)) conso ...
分类:
其他好文 时间:
2016-09-20 10:13:53
阅读次数:
122
Function引用类型创建的对象也叫函数。 一、创建函数: 1.function 函数名(x,y,z...){ 各种js语句 } 2.var 函数名=function(x,y,z...){ 各种js语句 } 二、调用函数: 函数名(); 三、函数可以有返回值:关键字return,如 输出结果如下: ...
分类:
Web程序 时间:
2016-09-20 10:05:30
阅读次数:
152
大多数函数都包含一条return 语句,return 语句导致函数停止执行。使函数停止执行的还有break,throw,他们叫强制跳转语句。 return语句使函数停止执行, 如果代码块里为 return; 或者 没有return; 那么函数会返回一个undefined值给调用者。 另外,在控制台为 ...
分类:
其他好文 时间:
2016-09-20 00:16:44
阅读次数:
126
题目: Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example,Given the following matrix: Y ...
分类:
其他好文 时间:
2016-09-20 00:16:40
阅读次数:
123
题目: Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For example,Given n = 3, You should return the fol ...
分类:
其他好文 时间:
2016-09-20 00:08:55
阅读次数:
153
var urls = window.location.search; //获取url?后面的的路径(参数) function uid(string) { if(string.indexOf('=') < 0) { //用indexOf方法判断url后面没有参数的情况,即<0 return {}; / ...
分类:
Web程序 时间:
2016-09-20 00:08:17
阅读次数:
159
题目: Given a list, rotate the list to the right by k places, where k is non-negative. (Medium) For example:Given 1->2->3->4->5->NULL and k = 2,return 4 ...
分类:
其他好文 时间:
2016-09-20 00:06:10
阅读次数:
231
题目: Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. If the last ...
分类:
其他好文 时间:
2016-09-20 00:00:24
阅读次数:
321