Проблем със задача 06. Road Radar от Syntax, Functions and Statements - Exercise
Здравейте,
получавам едва 11/100, някой може ли да ми помогне ?
Благодаря :)
задача:
https://judge.softuni.org/Contests/Practice/Index/2750#5
код:
function solve(speed, area) {
let result = ""
let limit = {
"motorway": 130,
"interstate" : 90,
"city" : 50,
"residential" : 20
}
let diff = speed - limit[area]
if(speed <= limit[area]) {
console.log(`Driving ${speed} km/h in a ${limit[area]} zone`)
} else {
if(speed <= 20) result = "speeding"
if(speed > 20 && speed <= 40) result = "excessive speeding"
if(speed > 40) result = "reckless driving"
console.log(`The speed is ${diff} km/h faster than the allowed speed of ${limit[area]} - ${result}`)
}
}
solve(40, "city");
solve(21, "residential")
solve(120, "interstate")
solve(200, "motorway");
Благодаря :)