var fs = require('fs');
// Read the input from the file
var input = fs.readFileSync('input.txt').toString().trim();
// Convert the input into an array of numbers
var array = input.split('\n').map(Number).filter(Boolean);
// Use filter to find elements greater than 5
var filteredArray = array.filter(num => num > 5);
// Print each element in the filtered array
filteredArray.forEach(num => console.log(num));
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