showing results for - "nodejs array write to lines file"
Juan Pablo
10 Oct 2020
1let arr = ["a", "b", "c", "d", "e", "f"];
2
3console.log(arr); // [ 'a', 'b', 'c', 'd', 'e', 'f' ]
4
5console.log(arr.join('\n'));
6// a
7// b
8// c
9// d
10// e
11// f
12
13let text = arr.join('\n');
14
15fs.writeFileSync('modified.txt', text, "utf8");
16
similar questions
queries leading to this page
nodejs array write to lines file