Judge не приема кода
Здравейте! Решавах задача 1 от поправката на Tech Fundamentals от 20 декември с JavaScript и в WebStorm ми изкара всички стойности вярно, но в Judge не ми я приема и хвърля грешка заради args.split(', ') на втори ред. Не съм решавал такава задача в Judge от лятото и не съм сигурен дали не са променили правилата за пращане на кода. Може ли да ми помогнете?
function stuff(args){
let input = args.split(', ')
let games = {}
let withDLC = {}
for (let i = 0; i < input.length; i++) {
if(input[i].includes('-')){
let current = input[i].split('-')
games[current[0]] = current[1]
}else if(input[i].includes(':')){
let current = input[i].split(':')
if(games.hasOwnProperty(current[0])){
withDLC[current[0]] = current[1]
}
}
}
let sorted = []
let another = []
for(let game in games){
if(withDLC.hasOwnProperty(game)){
sorted.push([game, Number(games[game])])
}else{
another.push([game, Number(games[game])])
}
}
sorted.sort(function(a, b){
return a[1] - b[1]
})
another.sort(function(a, b){
return b[1] - a[1]
})
for (let i = 0; i < sorted.length; i++) {
console.log(`${sorted[i][0]} - ${withDLC[sorted[i][0]]} - ${((sorted[i][1]*1.2) / 2).toFixed(2)}`)
}
for (let i = 0; i < another.length; i++) {
console.log(`${another[i][0]} - ${(another[i][1] * 0.8).toFixed(2)}`)
}
}
//stuff('Center Strike-15, FortLite-25, BattleShield 5-70, BattleShield 5:CoD edition, Dog of War-45, Dead Red Redemption-100, Dead Red Redemption:no DLC')
Това беше, благодаря много!