原型范围表示值的间隔.获得范围的首选方法是使用 $ R 效用函数.
您可以使用简单的语法创建大范围的值,如下所示;
$ R(1,10).inspect(); $ R('a','e').inspect();
这将产生以下结果 :
['1 ,2,3,4,5,6,7,8,9,10'] ['a','b','c','d','e']
include()方法
此方法确定该值是否包含在范围内 :
语法
Range.include(value);
返回值
如果包含值,则返回true值,否则为false.
示例
Prototype examples Click the button to see the result.