var fs = require('fs');
// Read the input from the file
var input = fs.readFileSync('input.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(' '));
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter