Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function calculateSales( salesFigures ){
- total = 0;
- salesFigures.forEach( function( quarter ){
- total += parseInt(quarter);
- });
- results = {
- "total" : total,
- "average" : total / salesFigures.length
- };
- return results;
- }
- window.onload =function(){
- console.log("ok");
- var salesFigures = Array();
- 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"));
- salesFigures.push(prompt("Second quarter because the first alert box wasn't annoying enough:"));
- salesFigures.push(prompt("You thought I was done? Shit jesus no! Third quarter:"));
- salesFigures.push(prompt("If you weren't expecting an annoying as shit demand for fourth quarter stats you can't fucking count"));
- var figures = calculateSales(salesFigures);
- 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?" );
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement