77
nanmu42
7y

Someone is wondering how to get this piece of code working as expected on StackOverflow:

for (var i = 1; i <= 2; i++) { setTimeout(function() { alert(i) }, 100); }

Found this gem in answers. :D

Comments
  • 25
    Some people really do want to watch the world burn 😥
  • 6
    @C0D4 After all, it did work. 😂
  • 8
    Of course it doesn't work.
    You put i<=2 as constraint,while StackOverflow has i <=3
  • 2
    @Tobyvw Yes, surly it is!! 😂😂😂😂
  • 2
  • 4
    This is why @froot makes fun of php developers :P
  • 4
    I hope it's sarcastic.
  • 2
    Downvote both imbeciles until they reach hell.
  • 2
    God has abandoned us.
  • 1
    Hahaha that's just hilarious xD
  • 5
    To bad he didn't threw another language in to the mix. Like, first you write this bash script that writes php that writes a piece of Javascript.
  • 2
    Haha...Umm,my friend didn't get it...someone care to explain it to him :P
  • 3
    @POTUS instead of solving the issue by using pure JS the idiot used PHP for the loop and printed (see as "generated") an HTML script tag to enable JS to do it's delay, callback and alert.

    Basically used three languages instead of one.
  • 2
    <script> let $getThing = <?= $_GET['thing'] ?> </script>

    Yes, saw it recently..
Add Comment