ixoywell / blog Goto Github PK
View Code? Open in Web Editor NEW丘尘子博客
Home Page: http://ixoywell.github.io/
丘尘子博客
Home Page: http://ixoywell.github.io/
forEach() 方法对数组的每一个元素执行一次提供的函数。
map() 方法创建一个新数组,其结果是该数组都执行一次函数,原函数保持不变。
filter() 方法使指定函数测试数组的每一个元素,并放回一个通过元素的新数组。
some() 方法测试该数组有元素通过了指定函数的测试,如果有返回true,否则,返回false。
every() 方法测试该数组是否全部通过指定函数测试,全部通过返回true,否则,返回false。
var arr = ["a", "b", "c"];
arr.forEach(function(element,index) {
console.log(element,index);
});
map 返回新数组,为当前元素加字符串m
var arr = ["a", "b", "c"];
arr.map(function(element,index) {
return element += "m";
});
// 将给定数组的元素转成整数
["1", "2", "3"].map(parseInt); // [1, NaN, NaN]
// 等价于
["1", "2", "3"].map(function(value,index,array){
return parseInt(value,index);
});
parseInt(3,1); // NaN parseInt(string, radix) 函数将给定的字符串以指定基数解析成为整数。
// 12, 130, 44
var arr = [12, 5, 8, 130, 44];
arr.filter(function(value){
return value>10
});
// 等价于
arr.filter((value)=>value>10);
var arr = [12, 5, 8, 130, 44];
arr.some(function(value){ // true
return value>10
});
var arr = [12, 5, 8, 130, 44];
arr.every(function(value){ // false
return value>10
});
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.