I am right now using the API of yodaspeak And I made some small changes on the codes. I want the user to input what words to change here is my node.js code
var YodaSpeak = require('yoda-speak');
var yoda = new YodaSpeak('hZy4MAVwtbmshFTdDuJSiMxKIxWsp1JSor1jsnuNeLjEVTnbXv');
console.log("Please enter the sentence you want to convert:");
process.stdin.on('readable', function() {
var chunk = process.stdin.read();
if (chunk !== null) {
yoda.convert(toString(chunk),
function(err, result) {
if (!err) {
console.log(result.toString());
} else {
console.log(err);
}
})
}
});
the console always tells error message I need to how to get the user input and convert it to string and assign it to a variable.
BTW in advance we need to install yoda-speak
%npm install --save yoda-speak
the error message is
Please enter the sentence you want to convert
fjesil
[object undefined].