0%

1. 模板引擎
var reg = /\$\{[a-zA-Z]+\}/g;
var tpl = "hello ${who}!";
var obj = {who:"world"};
function template(tpl,obj){
        var s = reg.exec(tpl);
        var s1 = s[0].slice(2,-1);
        document.write(tpl.replace(reg,obj[s1]));
    }
    //template(tpl,obj);
    template('Hello,${name}',{name:"hedahang"});
阅读全文 »

count方法

封装一个count方法,能实现如此调用:count(a)(b)(c)(d)(e)… 并且返回的值为参数连乘的结果,即abcde*…。如count(1)(3)(7) 得到21

阅读全文 »

找出数组中的素数

例如 shu([1,2,5,9,7,8,6,13,56,48,46]) = [2, 5, 7, 13];

function shu(arr){
    return arr.filter(
        function(num) {
          if (num == 1) {
            return false;
          }
          if (num == 2) {
            return true;
          }
          for (var i = 2; i <= Math.sqrt(num); i++) {
            if (num % i == 0) {
              return false;
            }
          }
          return true;
        }
    )
}

一、俯瞰全景

用断舍离的自在力俯瞰信息输入全景
微信:群、订阅号、朋友圈
微博、日报、新闻等APP
书籍、杂志
音频
其他

二、正本清源

梳理反思,及时清理对你造成困扰的信息源头。
以下是我的使用习惯,供参考
微信清退规则
群:没有群规,且超过一个月不曾发言
订阅号:未读数超 30
朋友圈:固定时间查阅
APP:关掉推送通知,关不掉就卸掉

阅读全文 »

1. Git安装和Github设置
使用Mac电脑可以直brew安装,
阅读全文 »

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

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment