-
Notifications
You must be signed in to change notification settings - Fork 676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It is possible to call function with 2 arguments? #102
Comments
No, it is not possible to call function with more than one arguments without eval in JSfuck. So... you need to come up with a way to represent this with functions with single argument. The solution that can express your immediate problem in JSfuck without eval: "truefalse".split("true").join("1") => "1false" "truefalse"["split"]("true")["join"]("1") And RegExp: "truefalse"["split"](RegExp("e"))["join"]("E") However, |
@hazzik actually it is possible :) Yesterday I ask question on stackoverflow and one smart guy: trincot discover the way for n-parameters (working example):
I also ask another question: it is possible to call such n-param methods in chain/flow way (not nested) e.g. "truefalse"
["split"]()["concat"]([["true"]["concat"]("1")])["reduce"](""["replace"]["apply"]["bind"](""["replace"]))
["split"]()["concat"]([["false"]["concat"]("0")])["reduce"](""["replace"]["apply"]["bind"](""["replace"])) In above code I use jsf characters |
Oh, cool. Nice. |
Now I need to recall why I wanted to get a way to call a method with two arguments. I completely forgot. :-( |
Suppose I have some string and want to use function "replace"
"truefalse"["replace"]("true") --> "undefinedfalse"
this line can be easily converted to JSF without using any kind of eval (interpreting string as code) as follows (I use comments and new lines to increase readability)
Questions:
It is possible to call function
replace
with 2 arguments - Like that:"truefalse"["replace"]("true","1")
and write it in similar way in JSF (without any kind of 'eval')? I have/see problem with comma which separate arguments... :(It is possible to write in similar way regular expression in replace function argument e.g.
"truefalse"["replace"](/e/g,"E")
(without any kind of 'eval') (we want to changee
toE
in whole string) ? (here I have/see problem with slash I don't know how to "construct" them in JSF to be interpreted as regexpThe text was updated successfully, but these errors were encountered: