+ 1
Help guys! SOS
I still haven’t figured out what this means var age = parseInt(readLine(), 10); “parseInt(readLine()” this is always coming up in the problems and I don’t even know how or what to do or play around it. Can anybody help? I would appreciate a brief explanation
14 odpowiedzi
0
[That link seems to be a Pro Code Coach task that somehow you have access to without Pro status. I cannot access it.]
Code Coach often provides pre-made, working, but incomplete, code to get you started. There is usually a comment that shows where you are to begin filling in the rest of the code to finish the task.
For that particular line I gave the long description before. Here it is in short:
the readLine() function waits for user input.
The user types the input.
The input gets converted into a number.
The number gets stored into the age variable.
Now your task is to use the value in the age variable to implement some logic and make decisions based on age [or so I assume].
+ 1
Here an example of a complete solution:
function main() {
var distance = parseInt(readLine(), 10);
//your code goes here
console.log(60*distance/40)
}
+ 1
Pxavier readLine() reads a line of text from the console.
parseInt(readLine(), 10); takes the line that was passed in from the console and parses out from the string an integer number. The argument, 10, specifies that we are expecting the number to be parsed as a decimal integer.
var age = parseInt(readLine(), 10)); takes the decimal integer output from parseInt and assigns it to the age variable.
+ 1
Brian ofcourse!
I get it now. Thank you
+ 1
// Try this function instead:
function setReminder(x){
console.log("You set a reminder about " + x);
}
+ 1
JaScript
Thanks! Alot!!!!!!
I’ve figured it out 🤠🤠🤠
0
The line coded data input for a task. You have to take the variable age and use for a solution.
0
This occurs in the tasks from a course or code coach with JavaSript. In this way the code is automatically supplied with new test data and then checks the results of the code for correctness.
0
JaScript okay.
So that means when trying to solve any problem Here an example of a complete solution:
parseInt(readLine(), 10;
The above should be ignored?
0
Pxavier can you be more detailed about what is your stumbling block? Is it the technical terms or is it a concept?
0
Brian
I’m trying to solve this
https://sololearn.com/coach/392/?ref=app
And i dont seem to understand the concept of that expression
0
Brian JaScript
Please what is wrong with this my code?!
It keeps saying error ‘fix bug’
😢😢😢😢😢
Can you help🙏🏿🙏🏿
function main() {
var eventExample = readLine();
// function call
setReminder(eventExample);
}
//complete the function
function setReminder(eventExample){
console.log("You set a reminder about " + eventExample);
}
setReminder("workout");
- 1
JaScript i still dont understand.
Am i to ignore “parselnt(readLine()”?
Where am i suppose to input the figure?
- 1
Brian i still dont understand 🤔🤔🥴🥴