随笔分类 -  Javascript

摘要:The join() method joins all elements of an array into a string.var name = 'shane osbourne';var upper = name.split(' ') // [shane, osbourne].map(x => x... 阅读全文
posted @ 2015-10-09 01:04 Zhentiw
摘要:For example there are two array of object and you want to print out each element, it is bad if you use two forEach method on each array:var people1 = ... 阅读全文
posted @ 2015-10-09 00:37 Zhentiw
摘要:JSPM can handle installed packages, transpiling ES6, and bundling all from the command-line. This video gives a quick overview of install JSPM, instal... 阅读全文
posted @ 2015-09-27 22:36 Zhentiw
摘要:Let's take a closer look at using Javascript's built in Array reduce function. Reduce is deceptively simple and when harnessed correctly can achieve v... 阅读全文
posted @ 2015-09-02 14:51 Zhentiw
摘要:ESLint is a JavaScript linter (static analysis tool) that offers full support for ES6, JSX, and other modern tools via plugins. We walk through settin... 阅读全文
posted @ 2015-08-28 03:57 Zhentiw
摘要:The very first thing to understand when we're talking about this-keyword is really understand what's the purpose of the this-keyword is, or why we eve 阅读全文
posted @ 2015-08-20 02:15 Zhentiw 阅读(428) 评论(0) 推荐(0)
摘要:Really the trick to flattening deeply nested structures is to just keep nesting map expressions until you have a variable or function argument, when i... 阅读全文
posted @ 2015-08-12 16:46 Zhentiw
摘要:Refactoring is a great opportunity to learn and we have an existing Javascript function that islengthy, hard to understand, and overcomplicated. We'll... 阅读全文
posted @ 2015-08-12 03:13 Zhentiw
摘要:Variable Hoisting// Variable Hoistingvar myVariable = 'Outer Value';var fn = function(){ alert(myVariable); var myVariable = 'New Local Value';};fn(... 阅读全文
posted @ 2015-08-01 22:01 Zhentiw
摘要:Armed with themapandconcatAllfunctions, we can create fairly complex interactions in a simple way. We will use Observable to create a simple drag and ... 阅读全文
posted @ 2015-06-30 21:37 Zhentiw
摘要:Like an array, Observable has a map method that allows us to transform a sequence into a new Observable.var Observable = Rx.Observable;//Create click ... 阅读全文
posted @ 2015-06-25 04:55 Zhentiw
摘要:In this lesson we will get introduced to theObservabletype. An Observable is acollection that arrives over time. Observables can be used to model even... 阅读全文
posted @ 2015-06-24 15:44 Zhentiw
摘要:Javascript modules are a design pattern that allow you to encapsulate your code into smaller self managing pieces. They help you separate your code, p... 阅读全文
posted @ 2015-06-24 15:01 Zhentiw
摘要:This lesson shows how to refactor your old loops into using a simpler and more powerful lodash-style. We will start by looking at how many people trad... 阅读全文
posted @ 2015-03-21 22:31 Zhentiw
摘要:In addition to flat Arrays, programmers must often deal with nested Arrays. For example let's say we have an Array of stock exchanges, each of which i 阅读全文
posted @ 2015-03-21 22:23 Zhentiw
摘要: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