update snippets 96-107
This commit is contained in:
@ -9,13 +9,14 @@ creating an array from contents of file by `split`ing file content line by line
|
||||
```js
|
||||
const fs = require('fs');
|
||||
const readFileLines = filename => fs.readFileSync(filename).toString('UTF8').split('\n');
|
||||
/*
|
||||
contents of test.txt :
|
||||
line1
|
||||
line2
|
||||
line3
|
||||
___________________________
|
||||
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']
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user