Replace 'window.location' to 'window["location"]'

Viewed 21

I am working on a tool and the javascript codes are in string. For eg: function demo() { window.location.href = "/new.html"} I want to make it as following: function demo() { window ["location"]["href"] = "/new.html"} Also i have have some functions that returns string in original form. For eg. dec("ycgfg") which returns string 'href'

Is it possible to make it like:

function demo() { window [dec("gctcgdv")][dec("ycgfg")] = "/new.html"}

Hope you understand what am I trying to say. Thank you.

0 Answers
Related