How could I improve this code?
I wrote this code and even though it works I feel like there should be an easier and better way to write it that I simply don't know how.
The main part I think could be improved is the
findSportEvents
function? Could someone review it please? 🙏
https://www.typescriptlang.org/play?#code/C4TwDgpgBAymD2AnYBRAbhAdsKBeKA3gFBRSYCGAthAFxQDOwiAlpgOYDcJUiE9ArgBtgdRi3ZcAvlyIBjeJkawACgHkASgBUA+igBqKAHKaYdAIKJE5EAB44SVBmwA+PFADa3AmSq0oAcjMoNHooACF-ABoePiERAIBGAFoABn8oSUivH2o6fwBhYNCAESiYgWE85IAWdMzsilyAlCKoADEy3gr4-2qk2oysgF0ZADN+TFlgZgUYjGQYJlY2AAoxUSX2AEpCbl5gfkRMBiYAOnowQWZgFf9-LdPeefoIFYeAK3hWW-upIiJxpNprMwOREC91LFhCsunENuI2DtiKR5IocKNmODgDB5Lw3KDwRAAJLYGFQ4BbLgohRKF6ogAmOKQ0HwBJeJJuTwgC02q1hwi2lP+pH2h2OyNIUGA8GA5EEAHF4HL6HQMVimXiANQMCAMjUQLKSqBsJWCehmAnxACy5GAAAtTuQAEb0FZqxj6qBJHV63EQLaGjJ-IgAehDUrtzFCgKmM2O9Dt8CE9JiByOUHIx3gTveupw8FGEegoEghCgTuYbDYfGAAHVWHR7Mh0FhgNFKMzFcrGwhm04cJJQ+GAO527nQCtVmv1+OJ5MxWQQZgYItQCD9qCj5iyO2r-k4O3kFP2ieV6uIY2m0LkS1DjOYFMd3hds0MOeCFO8RfL4tjtcbrcdygQ9H2ZS9lSgVgpRlOUAQmWNZgxB8m0cVtXXXNDzEsaw7F7VCXCRbhBAgHB6Vtcg6AlUgTWVC0wXiTB+EoJ1uSpSVpVlBUrzoRjmNY7hSEnatGBnHsHBbbA2NIJ8IBfFVYDwiTgDY6RhX-NDTlGJAUHIHcVjWRT+2iZh6QADx2XBXCoqBUSUbwaLNOjkGiDi5TkjJ8TBCFyQM8T+0eckhQEyDCxWEzTLwXB8BSQijVIMjZTcayjQc81LUDOLoM4uSMrioTpwbBhDNbXKjRkuTRGK7BSqDNSjVFI4pIyOqbJpHAozkpzgDCM9uTcVKuqgVwEvIU4BstJrbPa+hNBgrjlR6qcL3wVz5tfYbyNOVa5JkI1mFCgBCDqry6xbzygAAyC6oCOma5rks7uR2BrMF2yURqS4LqJOy06GO2jLUei8AH5wMcy0oDoEaxp++iau27jILu7KryBqBQYRiCoc2zGzRq-KRMK-7wfotHQYuPzW0hqBoYJutWBq8rEajWaUYW3qQaKynsGp6GmeVXLVNISQgpFEixV2I06dEmnyIO05pYZ4L+bNbHZXllX6EDVTBzvCBTMgKYIBTJNgDAfgRDvYgw0lRXMEonI-AKVpSmifcqn6Oosht6TO0R7xGidloQnaTpyTyPoBkHG3dds+BiNOQR4FWJDGSq4BXRgNQtF0AxjBgQUuCAATS Playground - An online editor for exploring TypeScript and JavaS...
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.
4 Replies
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
thanks a lot for taking time to look into it @matee 🙏 , unfortunately the
result
has to be a string
like "5-1"
though
thanks a lot for looking into it! that's definitely better! thanks 🙏Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
const [firstScore, secondScore] = result.split("-").map((value) => parseInt(value));
that's a nice way to parse it 👌
it was a challenge I've sent already so I had no way to change the structure of the objects, but I kept thinking how I could improve the code