went for JS realisation-everything compiles, but still not passing tests(