Javascript utils functions