Preview:
1)var fs = require('fs');

// Read the input from the file
var input = fs.readFileSync('concat.txt').toString().trim();

// Split the input into two parts using the comma
var [firstPart, secondPart] = input.split(',');

// Create arrays from the split parts, trimming each line
var firstArray = firstPart.split('\n').map(line => line.trim()).map(Number);
var secondArray = secondPart.split('\n').map(line => line.trim()).map(Number);

// Check for and filter out any NaN values from both arrays
firstArray = firstArray.filter(num => !isNaN(num));
secondArray = secondArray.filter(num => !isNaN(num));

secondArray.shift();


// Combine the arrays using the spread operator
var combinedArray = [...firstArray, ...secondArray];

// Print the output as a space-separated string
console.log(combinedArray.join(' '));



2)var fs = require('fs');


var input = fs.readFileSync('input.txt').toString().trim();

var numbers = input.split('\n').map(Number);


var filteredNumbers = numbers.filter(num => num > 5);


filteredNumbers.forEach(num => console.log(num));


3)var fs = require('fs');

// Read the input from the file
var input = fs.readFileSync('input.txt').toString().trim();

// Split the input into an array of numbers
var numbers = input.split('\n').map(Number);

// Sort the array in ascending order
numbers.sort((a, b) => a - b);

// Print the output, each number on a new line
numbers.forEach(num => console.log(num));
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