How it works:
The code given below will automate the process of amazon signup once you put it inside the web console, with all the values like name, email being picked automatically from the code and then you can edit the phone number section manually and then the password similarly.
The above code is divided into four sections(1-4) with each doing different things.
The first section is about creating a DOM element which we name as ‘script’ and then set the ‘type’ and ‘src’ of this element using the DOM setAttribute() method which adds the specific attribute to an element, and gives it the specified value. This element is basically the script which we are trying to run(jQuery code) and in the last line of this section, we append this element into the DOM body.
The second code section contains two arrays ‘nameArr’ and ’emailArr’ which contains several names and emails which we can iterate over and randomly choose values from. These randomly choosen magic takes place in code section 3, while the assigning to the DOM in code section 4.
In the last code section, we are basically assigning values to the DOM elements that we extract using the JQuery ‘$’ sign which demands a selector inside it and then it performs some action on it. Here we are just selecting and assigning values and then finally a setTimeout() method.