hi guys,

i am working through one of the hackerrank challenge, but kind of stuck while pushing the value into INTEGER_ARRAY, i am getting error as TypeError: Cannot read property ‘push’ of undefined.

as per my understanding we are using arrow function therefore we can use the parent function variables…(INTEGER_ARRAY) as well so i am not sure why this error is coming up

any suggestion please

link: https://www.hackerrank.com/challenges/dynamic-array/problem

code: below

```
'use strict';
const fs = require('fs');
process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', function(inputStdin) {
inputString += inputStdin;
});
process.stdin.on('end', function() {
inputString = inputString.split('\n');
main();
});
function readLine() {
return inputString[currentLine++];
}
/*
* Complete the 'dynamicArray' function below.
*
* The function is expected to return an INTEGER_ARRAY.
* The function accepts following parameters:
* 1. INTEGER n
* 2. 2D_INTEGER_ARRAY queries
*/
*function dynamicArray(n, queries) {*
* // Write your code here*
* *
* let INTEGER_ARRAY=[];*
* let lastans=0;*
* // make a string w from integer*
* let w = new Array(n) +''*
* let queriesx=new Array(queries) +''*
* // split on the bases of next line *
* queriesx= queriesx.split('\n')*
* const k = w.split(' ')[0]*
* for (let i=0; i<k; i++){*
*INTEGER_ARRAY[i]=[]*
* }*
*queriesx.forEach(e1=>*
*{*
* const [d,x,y] = e1.split('').map(Number)*
* //below is formula to extract the sequence number in array integer_array*
*const seq =((x ^ lastans)% k );*
***switch(d){***
*** // if d is 1***
case 1:
***INTEGER_ARRAY[seq].push(y);***
case 2:
***INTEGER_ARRAY[seq].push(y);***
***let value =y%INTEGER_ARRAY.length***
***lastans = value***
**}**
}
)
return INTEGER_ARRAY;
}
function main() {
const ws = fs.createWriteStream(process.env.OUTPUT_PATH);
const firstMultipleInput = readLine().replace(/\s+$/g, '').split(' ');
const n = parseInt(firstMultipleInput[0], 10);
const q = parseInt(firstMultipleInput[1], 10);
let queries = Array(q);
for (let i = 0; i < q; i++) {
queries[i] = readLine().replace(/\s+$/g, '').split(' ').map(queriesTemp => parseInt(queriesTemp, 10));
}
const result = dynamicArray(n, queries);
ws.write(queries);
//ws.write(result.join('\n') + '\n');
ws.end();
}
```