The methodology goes like this:
Step 2: Divide and Rule
and part 2 of the code as follows
In part 2, to interpret the given code as single string , one has to use characters ["" +]. Even for doing automated analysis, these parameters are required to be tuned so that appropriate interpretation of the string can be done. Check the string passed to variable "n".
Step 3: Extract the Logic
On the modular code (divided code snippets), try to apply the logic step by step (top to bottom). When we compute the value of "h" we get : h=-2*Math.log(Math.E); // h = -2 //
The next logic is to compute the value of "n" first. We have the n="[string]".split("a"), which means we have to split the string. By default, split function actually dissects the string n by a delimiter ",". We tweak the code a bit as presented below:
To compute the code finally, we need to unwrap the logic used in the loop. Step 4 involves the automation of the code.
Step4: Automating the Process - Python
In step 4, we need to automate the process to get the next value of the string. On understanding the logic, we write a following python script to compute the loop
The code actually multiply the every single value by 2 and build up the new string. So, we are almost at the end. So we need to build up the final code as presented below
So here we have the final script as follows
A good methodology always helps to attain the target.