Reputation: 11
abc.txt
John 22-08-1998 Bangalore 1111111111
const k;
this.k = sessionStorage.getItem('loggedUser');
if (k.UpperCase() === 'MEGHANA') {
const fs = require('fs')
const text = fs.readFileSync('./MEGHANA.txt').toString('utf-8')
const textByLine = text.split('\n')
document.write(textByLine[0])
}
Upvotes: 0
Views: 58
Reputation: 81
I hope this code is what you mean!
const k;
this.k = sessionStorage.getItem('loggedUser');
if (k.UpperCase() === 'MEGHANA') {
const fs = require('fs');
const text = fs.readFileSync('./MEGHANA.txt').toString('utf-8');
const textByLine = text.split('\n');
const textArray = textByLine[0].split(' ');
textArray.forEach(t => document.write(t));
}
Upvotes: 1