Advertisement
Guest User

Untitled

a guest
Sep 4th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. function calculateSales( salesFigures ){
  2. total = 0;
  3. salesFigures.forEach( function( quarter ){
  4. total += parseInt(quarter);
  5. });
  6. results = {
  7. "total" : total,
  8. "average" : total / salesFigures.length
  9. };
  10. return results;
  11. }
  12.  
  13. window.onload =function(){
  14. console.log("ok");
  15. var salesFigures = Array();
  16. salesFigures.push( prompt("Fuck your mother! I'm demanding first quarter sales with a prompt box because I'm an annoying cunt in JS 101"));
  17. salesFigures.push(prompt("Second quarter because the first alert box wasn't annoying enough:"));
  18. salesFigures.push(prompt("You thought I was done? Shit jesus no! Third quarter:"));
  19. salesFigures.push(prompt("If you weren't expecting an annoying as shit demand for fourth quarter stats you can't fucking count"));
  20.  
  21. var figures = calculateSales(salesFigures);
  22. alert("Total sales: "+figures.total+" quarterly average: "+figures.average+" because they'll probably teach us how to do this in a not totally fucktarded way in the first year of employment, right?" );
  23. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement