Level 15 (exceptionalCrossing.js)?

Level 15 (exceptionalCrossing.js)? - Anonymous person pressing button of lift

I'm stuck on Level 15 of Untrusted.

I've gotten this far with no actual knowledge of Javascript beyond knowing C and assuming things are the same. I see no possible solution to this puzzle without some trick of the language I don't know about- no matter what I put in there, player.killedBy() is going to be called, and the Professor is going to die.

Any hints?



Best Answer

Actually you can pass the level without throwing any exception, just hacking the code:

[line 32] player.killedBy('
');},'onCollision':function(player){map.getWidth(
);

Just replacing the "onCollision" action again with a function that doesn't do anything.
enter image description here

Then you can walk on water!!




Pictures about "Level 15 (exceptionalCrossing.js)?"

Level 15 (exceptionalCrossing.js)? - Person Drawing a Circle on a Calendar
Level 15 (exceptionalCrossing.js)? - Tall staircase with railings of concrete building
Level 15 (exceptionalCrossing.js)? - Small illuminating green neon bubble level placed on monitor stand in dark room





Puzzle 15 in 5 minutes - JavaScript - 5minsofcode.com




More answers regarding level 15 (exceptionalCrossing.js)?

Answer 2

Of course, the hint is in the name.

You've got to throw an exception.

Answer 3

I like this way:

player.killedBy(function() { throw 'I am Jesus';} ());

Answer 4

also u can use infinite recursion..

player.killedBy((function(){x=function(){x();};x();})());

Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Kelly, Artem Podrez, Tim Samuel, FOX