node required package example code.

<!--use the install package in npm-->

 const jokes = require("give-me-a-joke");

const colors = require("colors");

<!--call the package in variable and use the Variable "jokes" and the inbuilt method "getRandomDadJoke"
built your function to call them (joke) rainbow as method.

jokes.getRandomDadJoke(function (joke) {
    console.log(joke.rainbow)
});

Detect the language.


const franc = require("franc");
const langs = require("langs");
const input = process.argv[2];
const langCode = franc(input);
if (langCode === 'und') {
    console.log("Sorry, We  were not able to get our best...!!!")
}
else {
    const language = langs.where("3"langCode);
    console.log(`guess : ${language.name}`);
}




Comments