class testClass {
constructor(field) {
this.field = field;
}
print() {
console.log(this.field);
}
userInput1(data) {
let Input = data.toString().trim();
if (Input === 'r' || Input === 'R') {
this.field[0][1] = '5';
this.print();
}
}
userInput() {
process.stdin.on('data', this.userInput1);
}
}
const testVar = new testClass([[1,2,3], [3,2,1], [4,5,6]]);
testVar.print();
testVar.userInput();
/I'm trying to get the user Input. If user providing the Input which I'm looking for then I'm trying to modify the elements in 2D array. I am working with a project which needs the above implementation to be a part of the entire code./