How does HackThis!! Reverse console output?

? [stefanking56]
9 years ago

0

While testing some code for the coding levels, I noticed that the output is reversed.This seems like a funny easter egg. Could someone explain how this is done?

5replies
5voices
206views
dloser
9 years ago

0

Can you give a specific example? Works just fine over here…


0

yeah same here, example @dloser , in crypt9’s page console
console.log("abcd")
returns dcba

dloser
9 years ago

0

Ah.. that specific function. Well.. it does that everywhere on HackThis!! and it shouldn’t be too hard to find out why.. ;)

_TRYER_
9 years ago

0

you made me curious… why this happen?

singleton
9 years ago | edited 9 years ago

1

Nice, I haven’t noticed this before.
In order to find out why the returned string is reversed you need to do the following:

In the console, type alert(console.log) or better yet console.log(console.log.toString().split('').reverse().join('')) to see the function definition.
Apparently it was overridden by a custom one which reverses the output before actually calling the original console.log)

I have no idea why it was done, probably to mess with us during javascript levels or something.

Edit: A search for the function in the site’s code on GitHub reveals the reason in the commit message. Git blame FTW!

You must be logged in to reply to this discussion. Login
1 of 6

This site only uses cookies that are essential for the functionality of this website. Cookies are not used for tracking or marketing purposes.

By using our site, you acknowledge that you have read and understand our Privacy Policy, and Terms of Service.

Dismiss