随笔分类 - Javascript
摘要:Every time when a function run it will be push into the call stack and put on the top, you can think call stack is something like a heap... Javascirpt...
阅读全文
posted @ 2016-01-26 20:44
Zhentiw
摘要:In JavaScript, you can change the content of a string using thereplacemethod. This method signature is overloaded with a bunch of different ways to do...
阅读全文
posted @ 2016-01-15 02:13
Zhentiw
摘要:var input = "foobar";var result = input.replace('bar', '$`'); // $`: replace 'bar' with everything before our match.--> foofoovar input = "foobarbaz"...
阅读全文
posted @ 2016-01-15 02:06
Zhentiw
摘要:Learn how to use array reduction to create functional pipelines by composing arrays of functions.const increase = (input) => { return input + 1;}cons...
阅读全文
posted @ 2016-01-15 01:37
Zhentiw
摘要:A common problem when dealing with some kinds of data is that not every object has the same nested structure. lukeskywalker.parents.father.isjedi work...
阅读全文
posted @ 2016-01-14 03:19
Zhentiw
摘要:somereturns abooleanvalue after passing each item in the source array through the test function that you pass in as the first parameter. This makes it...
阅读全文
posted @ 2016-01-06 15:32
Zhentiw
摘要:JSON(JavaScript Object Notation) is a standard method to serialize JavaScript objects and is commonly used to transfer data from the server to the bro...
阅读全文
posted @ 2016-01-04 04:18
Zhentiw
摘要:indexOf is used to search for a value or reference inside of an array. In this lesson we first look at what values are returned when a search is succe...
阅读全文
posted @ 2015-12-30 22:23
Zhentiw
摘要:When using recursion, you must be mindful of the dreadedinfinite loop. Using the recursive function that we’ve built up over the previous lessons, we ...
阅读全文
posted @ 2015-12-30 02:53
Zhentiw
摘要:var ary = [ { id: 1, name: "Zhentian" }, { id: 2, name: "Alice" }];for..inPrint out the props namefor(let person in ary){ console.log...
阅读全文
posted @ 2015-12-26 18:03
Zhentiw
摘要:The combineReducers function we used in previous post:const todoApp = combineReducers({ todos, visibilityFilter});It accepts and object as agruement...
阅读全文
posted @ 2015-12-22 02:57
Zhentiw
摘要:Previous, we do composition with objects:const todoApp = (state = {}, action) => { return { todos: todos( state.todos, action ), v...
阅读全文
posted @ 2015-12-22 02:24
Zhentiw
摘要:Array filter creates a new array with all elements that pass the test implemented by the provided function. In this lesson we discuss how only a truth...
阅读全文
posted @ 2015-12-19 02:50
Zhentiw
摘要:Previous post:http://www.cnblogs.com/Answer1215/p/4990418.htmllet input, config, tasks;input = ['dist'];config = { "dist": ["build", "deploy"], "bui...
阅读全文
posted @ 2015-12-18 03:06
Zhentiw
摘要:Sort can automatically arrange items in an array. In this lesson we look at the basics including how to sort an array of strings alphabetically and th...
阅读全文
posted @ 2015-12-18 02:47
Zhentiw
摘要:Learn a few advanced reduction patterns: flatten allows you to merge a set of arrays into a single array, the dreaded flatmap allows you to convert an...
阅读全文
posted @ 2015-12-17 01:56
Zhentiw
摘要:For example, current we have those todos:{ todos: [ { completed: true, id: 0, text: "Learn Redux"}, { completed: false, id: 1, text: "Go shoppi...
阅读全文
posted @ 2015-12-17 01:23
Zhentiw
摘要:In the previous lesson we created a reducer that can handle two actions, adding a new to-do, and toggling an existing to-do. Right now, the code to up...
阅读全文
posted @ 2015-12-02 02:32
Zhentiw
摘要:Learn how to implement toggling a todo in a todo list application reducer.let todo = (state = [], action) => { switch(action.type){ case 'ADD_IT...
阅读全文
posted @ 2015-12-02 02:18
Zhentiw
摘要:Learn how to implement adding a todo in a todo list application reducer.let todo = (state = [], action) => { switch(action.type){ case 'ADD_ITEM...
阅读全文
posted @ 2015-12-02 01:53
Zhentiw