mercredi 23 mars 2022

How could I save the output of the console to a text file? [duplicate]

The title doesn't serve this question justice but I don't know how else to phrase it. (I already know that the contents of the console can be saved with a right-click, this is something different.) I'm using this for a different purpose, but let's simplify it so it's easier to understand. let's say that I have this code:

function getRandomInt(max) {
    return Math.floor(Math.random() * max);
}
const numberRandom = getRandomInt(999);
console.log(numberRandom);

This basically generates a 'random' number with a max of 999, let's say I want to run this code 100 times and have the output be saved to a text file, like this: "12, 135, 765, 457, 876" etc. Would there be a quick and clean method to do that? If not, what is the next best solution?




Aucun commentaire:

Enregistrer un commentaire