update snippets to new style
This commit is contained in:
@ -11,5 +11,5 @@ const fibonacci = n =>
|
||||
```
|
||||
|
||||
```js
|
||||
factorial(6) // 720
|
||||
fibonacci(6) // 720
|
||||
```
|
||||
|
||||
@ -14,5 +14,5 @@ const flattenDepth = (arr, depth = 1) =>
|
||||
```
|
||||
|
||||
```js
|
||||
flatten([1,[2],3,4]) // [1,2,3,4]
|
||||
flattenDepth([1,[2],3,4]) // [1,2,3,4]
|
||||
```
|
||||
|
||||
@ -23,12 +23,3 @@ let arr = readFileLines('test.txt')
|
||||
console.log(arr) // ['line1', 'line2', 'line3']
|
||||
```
|
||||
|
||||
```js
|
||||
contents of test.txt :
|
||||
line1
|
||||
line2
|
||||
line3
|
||||
___________________________
|
||||
let arr = readFileLines('test.txt')
|
||||
console.log(arr) // // ['line1', 'line2', 'line3']
|
||||
```
|
||||
|
||||
@ -11,6 +11,9 @@ const sdbm = str => {
|
||||
hashCode = currentVal.charCodeAt(0) + (hashCode << 6) + (hashCode << 16) - hashCode
|
||||
,0)
|
||||
}
|
||||
// console.log(sdbm("name")) // -3521204949
|
||||
// console.log(sdbm("age")) // 808122783
|
||||
```
|
||||
|
||||
```js
|
||||
console.log(sdbm("name")) // -3521204949
|
||||
console.log(sdbm("age")) // 808122783
|
||||
```
|
||||
@ -13,5 +13,5 @@ const timeTaken = callback => {
|
||||
|
||||
```js
|
||||
timeTaken(() => Math.pow(2, 10)) // 1024
|
||||
(logged): timeTaken: 0.02099609375ms
|
||||
// (logged): timeTaken: 0.02099609375ms
|
||||
```
|
||||
|
||||
@ -5,5 +5,8 @@ Use `new Date()` to get today's date, adding `86400000` of seconds to it(24 hour
|
||||
|
||||
```js
|
||||
const tomorrow = () => new Date(new Date().getTime() + 86400000).toISOString().split('T')[0];
|
||||
// tomorrow() -> 2017-12-27 (if current date is 2017-12-26)
|
||||
```
|
||||
|
||||
```js
|
||||
tomorrow() // 2017-12-27 (if current date is 2017-12-26)
|
||||
```
|
||||
|
||||
@ -107,7 +107,7 @@ round:math
|
||||
runPromisesInSeries:function
|
||||
sample:array
|
||||
scrollToTop:browser
|
||||
sdbmHashAlgorithm:math
|
||||
sdbm:utility
|
||||
select:object
|
||||
shallowClone:object
|
||||
shuffle:array
|
||||
|
||||
Reference in New Issue
Block a user