- Prototype 教程
- 原型 - 主页
- Prototype - 简要概览
- Prototype - 有用特性
- Prototype - 工具方法
- Prototype - 元素对象
- Prototype - 数字处理
- Prototype - 字符串处理
- Prototype - 数组处理
- Prototype - 哈希处理
- Prototype - 基本对象
- Prototype - 模板化
- Prototype - 枚举
- Prototype - 事件处理
- Prototype - 表单管理
- Prototype - JSON 支持
- Prototype - AJAX 支持
- Prototype - 表达范围
- Prototype - 周期性执行
- Prototype 有用资源
- Prototype - 快速指南
- Prototype - 有用资源
- Prototype - 讨论
原型 - without() 方法
该方法会生成一个新版本的数组,不包含任何指定的值。
语法
array.without(value...);
返回值
返回一个新数组,不包含指定元素。
示例
<html>
<head>
<title>Prototype examples</title>
<script type = "text/javascript" src = "/javascript/prototype.js"></script>
<script>
function showResult() {
var arr = ['Sam', 'Justin', 'Andrew', 'Dan', 'Sam'];
alert("Without Sam : " + arr.without('Sam').inspect() );
alert("Without Dan : " + arr.without('Dan').inspect() );
}
</script>
</head>
<body>
<p>Click the button to see the result.</p>
<br />
<br />
<input type = "button" value = "Result" onclick = "showResult();"/>
</body>
</html>
输出
prototype_array_processing.htm
广告