Publicidade - Adsense

Hack the JavaScript Evil Tester Sloganizer to Generate Random New Year's Resolutions


  • Moderador

    I wrote a blog post for the new year:

    And in there I noted that if you go off to the Evil Tester Sloganizer
    and type this code

    for(var x=0;x<100;x++){console.log("-" + process_sentence(sentences[30]));}
    

    Then you’ll get a bunch of New Year’s Resolutions printed out to the console:
    <a name=“more”></a>

    -I will try to pursue this risk further-I resolve to scrutinize requirements-I resolve to scrutinize ambiguity-I think I might just exploit this defect further-I will follow this risk further-I think I might just provide alternative alternatives-I will try to question more requirements-I will learn to test effectively-I resolved to scrutinize ambiguity-I think I might just test the lifeblood out of this system-I resolved to test the life out of this systemetc.
    

    But what if, we want them to appear in the sloganizer itself?

    Well, if instead of writing the console I wrote to the DOM, what would happen?

    document.getElementById("slogan").innerHTML=process_sentence(sentences[30])
    

    Ooh…

    And what if we wanted a new resolution every second? Because we are such a flibbertigibbet that we can’t stick to anything?

    Well, we’ve got you covered there too:

    resolutionBot = setInterval(function(){document.getElementById("slogan").innerHTML=process_sentence(sentences[30])}, 1000)
    

    And when we are done, remember to stop it:

    clearInterval(resolutionBot)
    

    Exercise: As an exercise to the reader, the code above changes the DOM but doesn’t update the application status, so if you found a good slogan you couldn’t click Tweet This and have the system tweet it for you. See if you can change slogan to the result of process_sentence(sentences[30]) such that you could Tweet This if you wanted to.
    <iframe allowfullscreen="" frameborder=“0” height=“315” src=“https://www.youtube.com/embed/3qH76RUt1Gc” width=“560”></iframe>


 

Publicidade - Adsense

status at

19
Online

2.8k
Usuários

1.7k
Tópicos

5.7k
Posts

});