update snippets to new style

This commit is contained in:
Stefan Feješ
2017-12-27 16:12:34 +01:00
parent eb0bf7427f
commit cb44eaa329
7 changed files with 13 additions and 16 deletions

View File

@ -11,5 +11,5 @@ const fibonacci = n =>
```
```js
factorial(6) // 720
fibonacci(6) // 720
```

View File

@ -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]
```

View File

@ -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']
```

View File

@ -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
```

View File

@ -13,5 +13,5 @@ const timeTaken = callback => {
```js
timeTaken(() => Math.pow(2, 10)) // 1024
(logged): timeTaken: 0.02099609375ms
// (logged): timeTaken: 0.02099609375ms
```

View File

@ -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)
```

View File

@ -107,7 +107,7 @@ round:math
runPromisesInSeries:function
sample:array
scrollToTop:browser
sdbmHashAlgorithm:math
sdbm:utility
select:object
shallowClone:object
shuffle:array