robin
                                            robin
                                        
                                    因为我正在做 leet, 一样的题。 借用对象字面量,对 ‘“是否存在另一个数” 与 “当前遍历的数” 之和为 target’ 这个问题进行判断。化 O(n^2) 为 O(n) ```js var twoSum = function(nums, target) { var result = []; var map = {}; var temp;...
@youngwind 是额,完全没有注意到,确实是多余的。只想到要返回number成员的数组,潜意识就加上了。可能是对js类型的不放心,或是ES5对象属性名都是字符串影响了我,XDDD..
@huirong 那个判断回文是从两边往中间比较,感觉万一比较到最后一个不相等... @crimx 判断回文是中间往两边比较,但是好像加了一堆null, NaN是为了正确计算回文字符串长度? 还看了几个解法,总结如下: ```js var longestPalindrome = function(s) { var len = s.length, max = 1, start = 0, temp = 0; if (len
@wangning0 zbinlin上面也有提到,这个工作就是 `babel-plugin-transform-react-jsx` 完成的,解析成了 `nodeName`, `attributes`, `children`, 至于传给谁,就是你可以指定选项 `pragma`为 `h`。你再仔细理解 @zbinlin 的回答。
@wangning0 因为你debug的这个项目依赖的`Preact`版本不一样,这个todomvc是依赖7.1版本,那个时候代码确实是这样子的:[https://github.com/developit/preact/blob/7.1.0/src/vnode.js](https://github.com/developit/preact/blob/7.1.0/src/vnode.js) . 而你又去对比Preact的最新源码,作者已经改实现方式,相关内容改到了这里: [https://github.com/developit/preact/blob/master/src/h.js#L51](https://github.com/developit/preact/blob/master/src/h.js#L51)
now it's auto follow precision of step. handle only change within steps and marks. what scene need this feature?
and it seems not support keyboardEvent to move handles. should it do ?
May be use custom handle with `Tooltips`? like this : [https://codesandbox.io/s/r0mx034494](https://codesandbox.io/s/r0mx034494)
不知道是以 obj1 的 key 为基准还是所有 key ```js function merge(keys1, keys2){ var keys = [].concat(keys1); keys2.forEach(function (i){ if (keys.indexOf(i) === -1){ keys.push(i); } }); return keys; } function compareObject(obj1, obj2){ var...
```js function domainName(url) { var reg = /(\w+:\/\/)?([^/:?#&]+)/; var str = url.match(reg)[2]; var arr = str.split("."); return arr[arr.length-2]; } ``` add case: ```js domainName("https://test.taobao.com") == "taobao" domainName("https://test.taobao.com?v=123") == "taobao" domainName("https://test.taobao.com#1")...