Comments (2)
ES5 对数组的扩展
ES5 定义了判断某个值是否为数组的方法:Array.isArray(value)
ES5 为数组定义了5个迭代方法:
every
: 对数组的每一项运行给定函数,如果每一项都返回true,则最终返回true
;
filter
: ...返回该函数返回true
的项组成的数组;
forEach
: ...没有返回值;
map
: ...返回每次函数调用的结果组成的数组;
some
: ...如果该函数对任一项返回true
,则返回true
。
var numbers = [1, 2, 4, 5];
// false
numbers.every(function (item, index, array) {
return item < 6;
});
from blog.
1. var $ = document.querySelector?
var $ = document.querySelectorAll.bind(document);
// 或者
function $ (selector) {
return document.querySelectorAll(selector);
}
参考Making a short alias for document.querySelectorAll
3. 其他:
- How to create a GUID / UUID in Javascript?
- How do I scroll a row of a table into view (element.scrollintoView) using jQuery?
from blog.
Related Issues (20)
- 初识polymer
- 洗牙一二事
- css HOT 1
- IE hack? forget it!
- MAC 使用技巧总结 HOT 2
- NODE_ENV 介绍
- 简单来说,好的页面设计是这样的
- 浅析 NodeJs 的几种文件路径 HOT 45
- 随便记点什么好了
- UI 测试之:保证页面滚动到底部
- handsome-articals
- handsome-articals
- 关于自动化 UI 测试的边边角角 HOT 1
- koa step by step
- Docker-1: 在 Mac OSX 上安装 boot2docker HOT 6
- some useful git tips for me HOT 4
- 用 gitbook 为项目写本书吧 HOT 2
- 一件有点悲伤的事情 HOT 1
- 机器人把狗屎扫了?
- 面向大型工作台的微前端解决方案 icestark
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blog.