Some js function that I find useful