In my project I need to take care about the case insensitive, and I don't know how can I code something like that in JavaScript.
If I write on my terminal, I need for my code to understand the same thing :
`BOB
bob
Bob`
My code :
#!/usr/bin/env node
let chunk = "";
process.stdin.on("data", data => {
chunk += data.toString();
});
process.stdin.on("end", () => {
chunk.replace(/^\s*[\r\n]/gm,"").split(/\s+/).ignoreCase.forEach(function (s) {
process.stdout.write(
s === 'bob'
? 'boy \n'
: s === 'alicia'
? 'girl\n'
: s === 'cookie'
? 'dog \n'
: 'unknown \n');
});
});
The result I need to display is :
`boy
boy
boy`
I tried to do it with ignoreCase
but it does not work, can you explain me why please?