+ 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 Answers
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 š¤š¤š„“š„“