0

Reference error??

I keep getting a reference error. I have document.write in my code and I get an error 'document is not defined"? With a little carrot under the "d" Any ideas?? function main() { var themeNumber = parseInt(readLine(), 2) /* 1 - Light 2 - Dark 3 - Nocturne 4 - Terminal 5 - Indigo */ // Your code here switch(themeNumber) { case 1: document.write ("Light"); break; case 2: document.write("Dark"); break; case 3: document.write ("Nocturnal"); break; case 4: document.write ("Terminal"); break; case 5: document.write ("Indigo"); break; default: document.write ("wtf"); break; } }

9th Jun 2022, 7:01 PM
Justin Nutt
Justin Nutt - avatar
4 Antworten
+ 4
Please show your code or link your codebit
9th Jun 2022, 7:03 PM
Chris Coder
Chris Coder - avatar
+ 3
The code is executed in Node.js, there is no document attached to it. Use console.log() instead of document.write() Also, I think it should be parseInt(readLine(), 10)
9th Jun 2022, 7:09 PM
Lisa
Lisa - avatar
+ 1
Please show your code so we can inspect the referrence error with the little carrot :)
9th Jun 2022, 7:05 PM
Lisa
Lisa - avatar
+ 1
Damn. I should have tried that first. Thanks!
9th Jun 2022, 7:12 PM
Justin Nutt
Justin Nutt - avatar