Solution for javascript