读书人

判断输入门类

发布时间: 2012-09-11 10:49:03 作者: rapoo

判断输入类型

//判断输入是否是数字

function cube(x) {

? if (typeof(x) != 'number') return 0;

? return x * x * x;

}

?

// Once you uncomment the type check in line 2, the

// cube function should return 0.

cube("test");

读书人网 >编程

热点推荐