Tips
JS Tips ¶
> 有用的 JavaScript 技巧
这是一个关于简短而有用的 JavaScript 技巧的很棒的项目,可以帮助您改进代码编写. 在不到 2 分钟的时间内,您可以阅读有关性能、约定、技巧、面试问题以及这门令人敬畏的语言的未来为我们准备的所有项目.
经常添加提示(如果您想保持联系,请进一步阅读).
Support the community¶
如果您发现 JS 技巧有用或者您喜欢社区的作者,您可以通过技巧表达您的支持和尊重!
Can you help us enrich it?¶
当然,您可以通过两种方式帮助该项目:发送提示或查看未来的提示. 任何改进或建议都非常受欢迎! Instructions are here.
Let’s keep in touch¶
获取更新的方法有很多:
> 别忘了 Star★ 回购,因为这有助于推广项目!
Tips list¶
- 74 - Check the reason make your page re-render by changed props and state
- 73 - Hash maps without side effects
- 72 - Adventurers Guide to React (Part I)
- 71 - VueJS, How VueJS makes a copy-update-replace inside the data binding
- 70 - Picking and rejecting object properties
- 69 - Enhancing React components, Composition
- 68 - Why you should use Object.is() in equality comparison
- 67 - Recursion, iteration and tail calls in JS
- 66 - State to Props maps with memory
- 65 - Tapping for quick debugging
- 64 - 3 Array Hacks
- 63 - Working With Websocket Timeout
- 62 - Preventing Unwanted Scopes Creation in AngularJs
- 61 - Binding objects to functions
- 60 - Three useful hacks
- 59 - ES6, var vs let
- 58 - Breaking or continuing loop in functional programming
- 57 - Comma operator in JS
- 56 - Copy to Clipboard
- 55 - Create an easy loop using an array
- 54 - How to use optional arguments in functions (with optional callback)
- 53 - Get File Extension
- 52 - Return Values with the 'new' Operator
- 51 - DOM event listening made easy
- 48 - Reduce builtin function usage
- 47 - Basics: Declarations
- 46 - Detect document ready in pure JS
- 45 - Calculate the Max/Min value from an array
- 42 - Preventing Unapply Attacks
- 41 - Array average and median
- 40 - Using JSON.stringify
- 39 - Advanced Properties
-
37 - Deduplicate an Array
- 36 - Observe DOM changes in extensions
- 35 - Assignment Operators
- 34 - Implementing asynchronous loop
- 33 - Create Range 0...N easily using one line
-
31 - Avoid modifying or passing
arguments
into other functions — it kills optimization - 30 - Converting truthy/falsy values to boolean
- 29 - Speed up recursive functions with memoization
- 28 - Currying vs partial application
- 27 - Short circuit evaluation
- 26 - Filtering and sorting a list of Strings
- 25 - Using immediately invoked function expression
- 24 - Use
===
instead of==
- 23 - Converting to number fast way
- 22 - Empty an Array
- 21 - Shuffle an Array
- 20 - Return objects to enable chaining of functions
- 19 - Safe String concatenation
- 18 - Truncating the fast (but risky) way
- 17 - Node.js: Run a module if it is not "required"
- 16 - Passing arguments to callback functions
- 15 - Even simpler way of using
indexOf
as a contains clause - 14 - Fat Arrow Functions #ES6
- 13 - Measure performance of a code block
- 12 - Pseudomandatory parameters in ES6 functions #ES6
- 11 - Hoisting
- 10 - Check if a property is in an Object
- 09 - Template Strings
- 08 - Converting a Node List to an Array
- 07 - "use strict" and get lazy
- 06 - Writing a single method for arrays and a single element
- 05 - Differences between
undefined
andnull
- 04 - Sorting Strings with accented characters
- 03 - Improve Nested Conditionals
- 02 - ReactJS - Keys in children components are important
- 01 - AngularJS:
$digest
vs$apply
- 00 - Insert item inside an Array