在 JavaScript 中处理异步和回调就是家常便饭,我们通常会面对这样一些问题:
1. 如何优雅滴组织我们的回调代码
2. 对异步函数错误处理的最佳实践是什么
3. 异步嵌套问题
4. 怎样使我们的代码可读性和可维护性更高
Programs are meant to be read by humans and only incidentally for computers to execute. 程序是给人读的,只是顺带让计算机执行一下。 ——《编写可维护的JavaScript》@Donald Knuth
当然,最常见也是最简单的处理方式就是,直接将回调函数或错误处理函数作为异步函数的参数,在异步函数返回时进行相应的调用,这继续阅读 »
Thanks for your recognition, that makes me exciting and exciting!
How time fast! It's really lucky for me to live in such a great team; I'd like to wok here with you for another 50 years, just not sure whether I can see screen clearly when I'm 80 years old :).继续阅读 »
How To Use the Widget Factory
To start, we'll create a progress bar that just lets us set the progress once. As we can see below, this is done by calling jQuery.widget() with two parameters: the name of the plugin to create, and an object literal containing functions to support our plugin. When our plugin gets called,继续阅读 »
今天突然想用markdown写博文,这样应该会方便不少。
开工
1.下载插件。
这里我选择了Markdown QuickTags
在官网看到
!This plugin hasn't been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
有点被惊呆
2.启用插件
下载完该插件之后,放入WordPress的plugins文件夹下,上传代码,然后再后台启用即继续阅读 »
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
Quick Start
Create a new post
bash
$ hexo new "My New Post"
More info: Writing
Run server
bash
$ hexo server
More in继续阅读 »
QNAN wiki上是这样说的:
A QNaN is a NaN with the most significant fraction bit set. QNaN’s propagate freely through most arithmetic operations. These values pop out of an operation when the result is not mathematically defined. (details)[http://en.wikipedia.org/wiki/NaN]
我尝试过sqrt(-1), 1/0, NAN/NAN都不行
结果:继续阅读 »