Not the time to work with Node.js🤔 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Not the time to work with Node.js🤔

I have lately started learning JavaScript , and there is a problem at the end of each module test . When I want to solve the problem , the compiler expects me to make a code with Node.js ! While Im not familiarized with that... can't I make one with JavaScript ?🤔

25th Apr 2021, 5:44 AM
Ali_combination
Ali_combination - avatar
9 Answers
+ 2
Ali_combination As sololearn have a NodeJS playground so it uses that for lessons. Which doesn't affect anything for you. You just need to write your logic. That parseInt line will take care of the input.
25th Apr 2021, 6:17 AM
Krish
Krish - avatar
+ 1
Please elaborate. I can't understand what you want to do? What code gives you this error?
25th Apr 2021, 5:55 AM
Krish
Krish - avatar
+ 1
Don't worry about it saying Node.js. Just write your js code as normal and run it. It will work if the code is correct. SL is just using it to check the module projects.
25th Apr 2021, 5:57 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
The code for the input for this end of module project should have been provided. Anyhow, use this as the first line in the main function. var depth = parseInt(readLine(), 10);
25th Apr 2021, 6:10 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
readLine() is a function that reads the input as a string. parseInt() takes a string with a numeric value as the first argument and the base as the second argument. So, parseInt("123", 10) will return the value 123 as an integer value with a base 10 (decimal). If the 2nd argument was a 2 it would give you the value as a base 2 integer (binary). Where 8 would be an octal and 16 a hexadecimal etc.
25th Apr 2021, 6:27 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
ChaoticDawg Solved:)) thank you so much dawg❤
25th Apr 2021, 6:44 AM
Ali_combination
Ali_combination - avatar
0
ChaoticDawg I think there are a lot of things that I have not learned yet ! Now problem "The snail in the Well" expects me to get an input from user , while I dont know how to get it... I searched for it and found prompt method . It actually recieves a string and I should convert it to an integer by parseInt() (while I have not learned this one either :/ ) . Now I can see that nothing is done in my code because the output is 0 . By the way , looks like prompt() is not defined in Node.js . I think I should have learned Node js before javascript...
25th Apr 2021, 6:06 AM
Ali_combination
Ali_combination - avatar
0
ChaoticDawg 👍👍👍👍whats the use of readline , 10 ? And how can I use it?
25th Apr 2021, 6:12 AM
Ali_combination
Ali_combination - avatar
0
Krish [less active] Thanks Krish❤
25th Apr 2021, 7:07 AM
Ali_combination
Ali_combination - avatar