0

How to solve?

What is the solution of -'7.3 practice problem in javascript'

14th Mar 2022, 6:27 AM
Sourya Banerjee
Sourya Banerjee - avatar
10 Answers
+ 5
Sourya Banerjee Here in the code above you have used "document.write" function which is used to give output on the document not in the console. To output the value of "p" in the console you need to use "console.log(p);". Rest of the code is perfect. Happy Coding đŸ€ 
14th Mar 2022, 6:58 AM
Adil
Adil - avatar
+ 3
Show your code first. We want to see what have you written?
14th Mar 2022, 6:30 AM
NonStop CODING
NonStop CODING - avatar
+ 2
document.write() is DOM related, front-end stuff and only available for front-end JS. Back-end JS e.g. Nodejs doesn't have access to DOM and therefore only allows output through logging into the console e.g. console.log() It depends where you're doing this ...
14th Mar 2022, 6:57 AM
Ipang
+ 2
Sourya Banerjee The code you've given here is working just by changing document.write to console.log.... I've checked it!
14th Mar 2022, 7:05 AM
Adil
Adil - avatar
+ 1
const readline = require('readline'); var computers = parseInt(readLine(), 10); var p= computers*2; document.write(p);
14th Mar 2022, 6:41 AM
Sourya Banerjee
Sourya Banerjee - avatar
+ 1
They are asking which is not taught till now
14th Mar 2022, 6:42 AM
Sourya Banerjee
Sourya Banerjee - avatar
+ 1
What's the issue?
14th Mar 2022, 6:42 AM
Sourya Banerjee
Sourya Banerjee - avatar
+ 1
What is the question it's for pro I can't access copy paste the question
14th Mar 2022, 6:44 AM
NonStop CODING
NonStop CODING - avatar
+ 1
In you code written above 1st line is for node js file module. Don't worry about that. That file module is used to read input from the user var computer is holding your input var p will have value twice of var computer last line is used for printing the value of variable p try using console.log(p)
14th Mar 2022, 6:46 AM
NonStop CODING
NonStop CODING - avatar
0
Oo... thanks but they are still not taking the solution
14th Mar 2022, 7:03 AM
Sourya Banerjee
Sourya Banerjee - avatar