2016-06-16 阅读 javascript 的 api 设计原则 Improving CSS quality at Facebook and beyond Javascript Debugging With Black Box 聚沙 betterParseInt 1 2 3 4 5 6 var betterParseInt = function(str) { str = str.trim(); if(/^(\-|\+)?\d+$/.test(str)) return Number(str); return NaN; } Comments Please enable JavaScript to view the comments powered by Disqus.