Working on a program from Kattis, and I’ve been using Codecademy’s Workspaces to test the code.
What is the issue with this piece of code?
var input = readLine(Word:
);
if (input.includes(‘ss’)) {
console.log(‘hiss’)
} else {
console.log(‘no hiss’)
};
Project link: Hissing Microphone – Kattis, Kattis
I noticed you are using readLine() which is the read input function for Java. Consider going through the tutorial for JavaScript since they are different even if they share the word Java.
After you have gone through the tutorial and still having error, check the spoiler.
readLine is not a function (at least without modules). You either define and retrieve input with your own way, or by this
var readline = require('readline');
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});//ugly formatting but whatever
this defines readline() so you can get input.
after that,
rl.question("", function(input) {
//your code
rl.close();
});