StefiIOE

1.5

Nov 3rd, 2020
946
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'use strict'
  2.  
  3. var readline = require('readline');
  4. var rl = readline.createInterface({
  5.   input: process.stdin,
  6.   output: process.stdout,
  7.   terminal: false
  8. });
  9.  
  10. rl.question('', (p1) => {
  11.   rl.question('', (p2) => {
  12.     p1 = p1.split(", ")
  13.     p2 = p2.split(", ")
  14.    
  15.     console.log(merge(p1,p2))
  16.  
  17.     rl.close();
  18.   })
  19. });
  20.  
  21. // DO NOT CHANGE ABOVE THIS LINE!!!!
  22.  
  23. const merge = function(niza1, niza2)
  24. {
  25.     // Write this function
  26. var finalnaNiza = [];
  27. for(var i = 0 ; i <niza1.length ; i ++){
  28.     var element1 = niza1[i];
  29.     var element2 = niza2[i];
  30.     var element3 = [element1,element2];
  31.     finalnaNiza[i] = element3;
  32. }
  33. return finalnaNiza;
  34.    
  35. }
RAW Paste Data