const faker = require('faker'); const randomWord = faker.random.word(); console.log(randomWord); // Output: "vestibulum"
const faker = require('faker'); const wordArray = []; for (let i = 0; i < 5; i++) { wordArray.push(faker.random.word()); } console.log(wordArray); // Output: ["elit", "convallis", "sit", "mi", "nullam"]In this example, we use a for loop to push five random words into an array. The output is an array of five English words. Faker is a package library that can be obtained using Node.js package manager (npm).