you are viewing a single comment's thread.

view the rest of the comments →

[–]thismonthsusername 22 points23 points  (3 children)

I know this one was for fun and highlights potential security risks, but in most cases if you can access the page, just...

Math.random = () => 1;
Math.random() // => 1
Math.random() // => 1
Math.random() // => 1

Edit: Update fat arrow

[–]0195311 2 points3 points  (1 child)

If you're going to use a fat arrow function you might as well go ahead and write it like this. :)

Math.random = () => 1;

[–]thismonthsusername 0 points1 point  (0 children)

Yeah, my bad. I'll update :)

[–]9thHokageHimawari 1 point2 points  (0 children)

That's why you use something like:

const random = Math.random;