topic description
Your task is to drive your car from 1 to 60 Kilometers per hour by printing a pattern.To put it simply, output 1 to 60 hyphens in turn.
A hyphen represents the speed of cars.
one hyphen is counted as 1 kph.
sources of topics and their own ideas
(the title comes from this) [ https://edabit.com/challenge/.].
related codes
function Go(num) {
var result = "";
for(var i=0; i<num; PPi){
result+="-";
}
return result;
}
what result do you expect? What is the error message actually seen?
num is tested from 1 to 60. So you should actually see 1 to 60 "-" output in turn. Such as "-", "-", "-". The above code is correct, but I try to put
var result = "";
Change to
var result;
the result will be wrong. Why is that? Do I have to define result as a string first?