JS - iaccess - ES6 (2)

PHOTO EMBED

Sat Oct 19 2024 09:45:01 GMT+0000 (Coordinated Universal Time)

Saved by @signup #html #javascript

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));
content_copyCOPY