string file to array javascript code example
Example 1: javascript convert file to array
var fs = require('fs');
var text = fs.readFileSync("./mytext.txt", 'utf-8');
var textByLine = text.split('\n')
Example 2: javascript text to array
var str = "How are you doing today?";
var res = str.split(" ");