Last active
October 2, 2019 01:09
-
-
Save jaxatax/e28174b36b6ff3722315e1212c403341 to your computer and use it in GitHub Desktop.
Makes a random fake company name.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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