A resolution to structure js codes