随笔分类 -  Javascript

摘要:Both map and filter do not modify the array. Instead they return a new array of the results. Because both map and filter return Arrays, we can chain t 阅读全文
posted @ 2015-03-21 22:16 Zhentiw
摘要:One very common operation in programming is to iterate through an Array's contents, apply a test function to each item, and create a new array contain 阅读全文
posted @ 2015-03-21 22:12 Zhentiw
摘要:One very common operation in programming is to iterate through an Array's contents, apply a function to each item, and create a new array containing t 阅读全文
posted @ 2015-03-21 22:06 Zhentiw
摘要:Most JavaScript developers are familiar with the for loop. One of the most common uses of the for loop is to iterate through the items in an array. In 阅读全文
posted @ 2015-03-21 22:01 Zhentiw
摘要:Leaflet Demo $.getJSON('//jsbin.com/qogati/1.js', renderMap);function renderMap (geoData) { var map = L.map('map'); var osm = '//{s}.tiles.mapb... 阅读全文
posted @ 2015-03-21 20:56 Zhentiw
摘要:Leaflet makes creating maps in the browserdead simple. With some HTML and 3 lines of JavaScript, we can quickly have a map displaying// create a map i... 阅读全文
posted @ 2015-03-20 23:16 Zhentiw
摘要:window.onload = function() { var canvas = document.getElementById("canvas"), context = canvas.getContext("2d"); var gradient =context.cre... 阅读全文
posted @ 2015-03-20 04:50 Zhentiw
摘要:window.onload = function() { var canvas = document.getElementById("canvas"), context = canvas.getContext("2d"), width = canvas.width = 600,... 阅读全文
posted @ 2015-03-19 23:39 Zhentiw
摘要:window.onload = function() { var canvas = document.getElementById("canvas"), context = canvas.getContext("2d"); context.beginPath(); c... 阅读全文
posted @ 2015-03-19 22:00 Zhentiw
摘要:HTML5 Canvas Graphics and Animation/** * Created by Answer1215 on 3/19/2015. */window.onload = function() { //var canvas = $("#canvas")... 阅读全文
posted @ 2015-03-19 21:34 Zhentiw
摘要:sortBy:var collection = ['John', 'Petteri', 'Antti', 'Joonas', 'Zhentian'];var sorted = _.sortBy(collection);//[ 'Antti', 'John', 'Joonas', 'Petteri',... 阅读全文
posted @ 2015-03-04 03:52 Zhentiw
摘要:Using ES6To use ES6, we need loader.Modify webpack.config.js file:module.exports = { entry: './index.js', output: { filename: 'bundle.js'... 阅读全文
posted @ 2015-03-04 03:21 Zhentiw
摘要:To use webpack, first you need to run:npm install webpack2. Create a webpack.config.js file:module.exports = { entry: './index.js', output: { ... 阅读全文
posted @ 2015-03-03 04:17 Zhentiw
摘要:1 //search 2 bower search jquery 3 4 bower search jquery | grep formstyler 5 6 //info 7 bower info jquery 8 9 //install (lastest one)10 bower inst... 阅读全文
posted @ 2014-12-22 04:46 Zhentiw
摘要:We have code like:var numbers = [1,2,3];for(var i in numbers){ setTimeout(function(){console.log(numbers[i]); }, 0);}//3//3//3Note:1. function... 阅读全文
posted @ 2014-12-17 18:47 Zhentiw
摘要:var people = [ {name: "Rank", age: 40}, {name: "Bob", age: 35}, {name: "Gegg", age: 30}, {name: "Leate", age: 18}, {name: "Matti", age: 34}, {na... 阅读全文
posted @ 2014-10-10 20:26 Zhentiw
摘要:Read More:http://joelhooks.com/blog/2014/02/06/stop-writing-for-loops-start-using-underscorejs/How many for loops did you write today? This week?12345... 阅读全文
posted @ 2014-10-09 05:38 Zhentiw
摘要:1. Want to use bower you need to have node npm and git. 2. Download node.js and git if you don't have. 3. Add nodejs and git & git cmd into the PATH. 阅读全文
posted @ 2014-08-31 05:13 Zhentiw
摘要:/** Augmentation*/var wartime = true;var ARMORY = (function( war ){{ //add var to the private properties var weaponList = [*list of weapon ob... 阅读全文
posted @ 2014-08-17 20:31 Zhentiw
摘要:/** Global Imports*/var wartime = true;var ARMORY = (function(){{ //add var to the private properties var weaponList = [*list of weapon objec... 阅读全文
posted @ 2014-08-17 20:30 Zhentiw