Find the capitalsDescription:InstructionsWrite a function that takes a single string (word) as argument. The function must return an ordered list cont...
直接先看两段代码
function getSum() {
var sum = a + b;
var a = 1;
var b = 2;
return sum;
}
getSum();
function getSum() {
...
分类:
编程语言 时间:
2015-07-05 18:37:05
阅读次数:
135
使异常处理变得更灵活、可观察,可以使用设计模式中的观察者模式。文件 ① 定义观察者的接口ExceptionObserver.php:1 notify();15 }16 17 //通知每一个观察者的方法18 public function notify(){19 ...
分类:
Web程序 时间:
2015-07-05 18:17:57
阅读次数:
147
请实现一个js脚本,要求做到将数字转化为千分位表示
如:
10000 ----> 10,000
10000121213 ----> 10,000,121,213
今天无意中看到这道题目,想了4种解决方案,和大家分享一下:
//法一
function parseNum(num){
var list = new String(num).split('').reverse(...
分类:
Web程序 时间:
2015-07-05 16:54:11
阅读次数:
157
Given a binary search tree, write a function kthSmallestto find the kth
smallest element in it.
Note:
You may assume k is always valid, 1 ≤ k ≤ BST's total elements.
解题思路:
求BST(二叉排序树)中第k小的数...
分类:
其他好文 时间:
2015-07-05 16:53:00
阅读次数:
150
S1:js中一切皆对象,想想如果要实现对父对象属性和方法的继承,最初我们会怎样子来实现呢,考虑到原型的概念,最初我是这样来实现继承的function Parent(){ this.name='123';}Parent.prototype.getName=function(){ return ...
分类:
编程语言 时间:
2015-07-05 16:35:49
阅读次数:
104
原文地址:http://www.cnblogs.com/gb2013/archive/2013/03/05/SecurityEnhancementsInTheCRT.html在VS 2012 中编译 C 语言项目,如果使用了 scanf 函数,编译时便会提示如下错误:error C4996: 'sc...
分类:
其他好文 时间:
2015-07-05 16:28:48
阅读次数:
101
在JavaScript中,有5种基本数据类型和1种复杂数据类型,基本数据类型有:Undefined, Null, Boolean, Number和String;复杂数据类型是Object,Object中还细分了很多具体的类型,比如:Array, Function, Date等等。今天我们就来探讨一下,使用什么方法判断一个出一个变量的类型。 在讲解各种方法之前,我们首先定义出几个测试变量,看看后面的...
分类:
编程语言 时间:
2015-07-05 15:06:59
阅读次数:
142
var Timeline=function(){this.order=[];this.add=function(timeout,func,log){ this.order.push({ timeout:timeout, func:func, log:log ...
分类:
Web程序 时间:
2015-07-05 14:52:36
阅读次数:
200
Descending OrderDescription:Your task is to make a function that can take any non-negative integer as a argument and return it with it's digits in des...
分类:
其他好文 时间:
2015-07-05 13:45:16
阅读次数:
131