Advertisement
DNNdrago

13. *Digital Soothsayer

Jul 23rd, 2014
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function soothsayer(value) {
  2.     var numbers = value[0],
  3.         languages = value[1],
  4.         cities = value[2],
  5.         cars = value[3];
  6.     var result = [numbers[Math.floor(Math.random() * 4)],
  7.                   languages[Math.floor(Math.random() * 4)],
  8.                   cities[Math.floor(Math.random() * 4)],
  9.                   cars[Math.floor(Math.random() * 4)],];
  10.     return result;
  11. }
  12.  
  13. function print(result) {
  14.     console.log('You will work ' + result[0] + ' years on ' + result[1] + '. You will live in ' + result[2] + ' and drive ' + result[3] + '.');
  15. }
  16.  
  17. print(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