2018年1月11日

摘要: 在let和const之间,建议优先使用const,尤其是在全局环境,不应该设置变量,只应设置常量。 const优于let有几个原因。一个是const可以提醒阅读程序的人,这个变量不应该改变;另一个是const比较符合函数式编程思想,运算不改变值,只是新建值,而且这样也有利于将来的分布式运算;最后一个 阅读全文
posted @ 2018-01-11 17:14 暖暖的心窝子 阅读(677) 评论(0) 推荐(0)
 
摘要: Object.getPrototypeOf(ColorPoint) PointColorPoint是子类 Point是父类 阅读全文
posted @ 2018-01-11 16:10 暖暖的心窝子 阅读(920) 评论(0) 推荐(0)
 
摘要: function spawn(genF) { return new Promise(function(resolve, reject) { const gen = genF(); function step(nextF) { let next; try { next = nextF(); } cat 阅读全文
posted @ 2018-01-11 15:36 暖暖的心窝子 阅读(758) 评论(0) 推荐(0)