随笔分类 - Javascript
摘要:When you have a dependency that does not export itself properly, you can use the exports-loader to force it to export the pieces of the file that you
阅读全文
摘要:If you have a multi-page application (as opposed to a single page app), you’re likely sharing modules between these pages. By chunking these common mo
阅读全文
摘要:Often, you have dependencies which you rarely change. In these cases, you can leverage the CommonsChunkPlugin to automatically put these modules in a
阅读全文
摘要:Leveraging the browser cache is an important part of page load performance. A great way to utilize this cache is by versioning your resources. In this
阅读全文
摘要:As a Single Page Application grows in size, the size of the payload can become a real problem for performance. In this lesson, learn how to leverage c
阅读全文
摘要:If you're going to use code splitting with Webpack 2, you'll need to make sure the browser has support for the ES6 Promise API. This means that if you
阅读全文
摘要:The less code you can send to the browser, the better. The concept of tree shaking basically says that if you’re not using some piece of code, then ex
阅读全文
摘要:It’s quite common to make a mistake while developing your webpack configuration. A simple typo can cost you hours of development time. With webpack-va
阅读全文
摘要:There are several lessons that will build on top of this project. It is a fairly standard, small webpack bundled project. In this lesson we’ll explore
阅读全文
摘要:slice filter map ...spread concat Object.assign
阅读全文
摘要:delete keyword doesn't actually delete the value but just the reference. So here, what actually delete is the point of me.name: So the point from 'anm
阅读全文
摘要:First, what is 'High Order function', basic just a function, inside the function return another fuction. For example: Decorators is a subset of high o
阅读全文
摘要:new.target is a new “magical” value available in all functions, thoughin normal functions it will always be undefined. In any constructor,new.target a
阅读全文
摘要:Each function should have a 'name' property. It can be anonymous, empty, the same as function name, or class name. For example:
阅读全文
摘要:Learn how to use console.table to render arrays and objects in a tabular format for easy scanning over the values. We'll create some mock data and the
阅读全文
摘要:Learn to use console.time with console.timeEnd to get accurate timings of operations in javascript. This tool can help with javascript profiling and p
阅读全文
摘要:Learn how to user console.count in order to log out how many times a given thing has happened. for(var i = 0; i < 10; i++){ var num = Math.random() *
阅读全文
摘要:Learn about console.assert, which is syntactic sugar for logging an error the console when a given condition is not met. It's useful, but may not do w
阅读全文
摘要:Organize your log output by grouping your logs into collapsable hierarchies using console.group(). for(var i = 0; i < 100; i++){ var num = Math.random
阅读全文
摘要:With endsWith && startsWith, you can easily find out whether the string ends or starts with some other string: example: So you don't need to write reg
阅读全文