+ 1
Help my code not work
ReferenceError: "idk" is not defined https://code.sololearn.com/c316KrpPFB26/?ref=app
7 Answers
+ 2
At line 7 ā(idk ==sus)" .. it gives you the error because it's outside of the function, a variable declared inside a function is local and can be accessed only inside that function. Also would recommend to use let or const keyword to declare variables unless you're making something that had to work on a browser version older than 2015.
+ 2
i think you can writ (let idk) , var isn't good . š¤
0
Firstly, you haven't called your main function so the variable idk is never defined in your code & secondly, you don't read input with just readline() in the nodejs.
0
Ok 1st thing don't use the main function it has no use in the code
0
2nd: that's how you take the user input from the readline module
https://www.geeksforgeeks.org/node-js-readline-module/
0
It's because sus is not being declared and assigned and instead of a function in var idk,replace it with something else