Here is the link of the problem and the screenshot of it. ClickMeToTheProblem
Here are some of my trials: (in chronological order)
1. Make the guess to be the var of lucky_number. As expected, it throws out an undefined error because the checking is after executing my code.
2. Guess some numbers.
3. Make the guess to be a function so that it can be get the value of lucky_number later using something like eval('lucky_number').
4. Guess some numbers again ...... :)
5. Make the guess to be a lazy evaluation variable or function so that it can be in the scope of the expected number when it is evaluated.
However, none of these are working because I messed up with the scope. After a few trials, I feel like this problem is unsolvable. Then I tried to look at some discussions. I saw a person asking why the method of changing the kernel random method is not working. It did inspire me. Now, I know the answer ......
Math.floor = function (a) {
return 1
}
var myGuess = Math.floor('hacked it :)')
This question is really interesting and funny to play around. I have spent about 2 hours on this simple question. But I feel like I am leveling up. @@
P.S. I thinking to `open source` this blog plugin which is built in react.js and make it handy for other people to plug in their sites. Let's see.





沒有留言:
張貼留言