Code works on IDE (WebStorm) or JSFiddle and on codewars BUT on codewars it has another result. So code pass base tests on codewars but not some random tests. On other hand