Js function without any libraries or framework