Skip to content
Advertisement

How to Merge arrays generated from the for loop

for a example: I have array a

JavaScript

my current code

JavaScript

Current output:

JavaScript

Required output: 1)If i return the variable border in the above function it onlx gives the value of first array, so its returns both the arrays with print function. 2)How to combine both the array like mentioned below expected ouput

JavaScript

Advertisement

Answer

You could use an array to collect the True values:

JavaScript

output:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement