Advertisement
coasterka

soothsayer.js

Jul 16th, 2014
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var soothsayer = function(input) {
  2.     var years = input[0];
  3.     var languages = input[1];
  4.     var cities = input[2];
  5.     var cars = input[3];
  6.     var money = Math.floor(Math.random()*10000001);
  7.    
  8.     var isLoved = Math.random() < 0.5;
  9.     var isLovedResult;
  10.    
  11.     if(isLoved) {
  12.         isLovedResult = "will love you deeply";
  13.     }
  14.     else {
  15.         isLovedResult = "won't stop cheating on you";
  16.     }
  17.    
  18.     var result = [];
  19.    
  20.     result[0] = years[Math.floor(Math.random()*years.length)];
  21.     result[1] = languages[Math.floor(Math.random()*languages.length)];
  22.     result[2] = cities[Math.floor(Math.random()*cities.length)];
  23.     result[3] = cars[Math.floor(Math.random()*cars.length)];
  24.     result[4] = money;
  25.     result[5] = isLovedResult;
  26.    
  27.     console.log("You will work " + result[0] + " years on " + result[1] + ". You will live in " + result[2] + " and drive " + result[3] + ". You will leave a legacy in the amount of $" + result[4] + ". Your spouse " + isLovedResult + ".");
  28. };
  29.  
  30. soothsayer([[3, 5, 2, 7, 9], ["Java", "Python", "C#", "JavaScript", "Ruby"], ["Silicon Valley", "London", "Las Vegas", "Paris", "Sofia"], ["BMW", "Audi", "Lada", "Skoda", "Opel"]]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement