Skip to content

Instantly share code, notes, and snippets.

@jaxatax
Last active October 2, 2019 01:09
Show Gist options
  • Save jaxatax/e28174b36b6ff3722315e1212c403341 to your computer and use it in GitHub Desktop.
Save jaxatax/e28174b36b6ff3722315e1212c403341 to your computer and use it in GitHub Desktop.
Makes a random fake company name.
// REFERENCE (Working with .txt Files in JS): https://www.freecodecamp.org/forum/t/how-to-read-local-text-file-into-a-js/231112
var fs = require('fs');
var textByLine = fs.readFileSync('allthewords.txt').toString().split("\n");
//get random element from array
Array.prototype.randomElement = function () {
return this[Math.floor(Math.random() * this.length)];
}
//console.log(textByLine[500]);
company = textByLine.randomElement() + " " + textByLine.randomElement() + "ly";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment