How node.js reads numbers at a specific location

RT. I keep a lot of numbers in a file, all separated by newline (n).
for example:
1
2
3
4
saved like this, how can you take out the value of a specific location, for example, if you want to take out the value of 3, or always take out the penultimate value?

Mar.10,2021

text.txt content:

1
2
3
4
5
6

the code is as follows:

const fs = require('fs')
const fileName = './test.txt'

let content = fs.readFileSync(fileName, 'utf-8')
/*  */
let arr = content.split(/[\s]*\n[\s]*/)
console.log(arr) // [ '1', '2', '3', '4', '5', '6']
After

is cut into array , the value can be taken by specifying the location.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36fa4-34423.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36fa4-34423.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?