JS - iaccess - ES6 (1)
Sat Oct 19 2024 09:44:10 GMT+0000 (Coordinated Universal Time)
Saved by
@signup
#html
#javascript
var fs = require('fs');
// Read the input from the file
var input = fs.readFileSync('concat.txt').toString().trim();
// Split the input by comma to separate the two arrays
var [firstArrayInput, secondArrayInput] = input.split(',');
// Convert the first array input into an array of numbers
var firstArray = firstArrayInput.split('\n').map(Number).filter(Boolean);
// Convert the second array input into an array of numbers
var secondArray = secondArrayInput.split('\n').map(Number).filter(Boolean);
// Combine both arrays using the spread operator
var combinedArray = [...firstArray, ...secondArray];
// Print the output
console.log(combinedArray.join(' '));
content_copyCOPY
Comments