javascript code for amd