Advertisement
Guest User

Aqui

a guest
Dec 14th, 2020
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function print (value)
  2. {
  3.         var all = value.length;
  4.         // remove o ultimo valor : u = u.substring(0,str.length-1);
  5.         for (var i = 1 ; i <= all-1; i++)
  6.         {
  7.             var novo = value[i];
  8.             var paran = novo.length;
  9.             for (ii = 0; ii <= paran; ii++)
  10.             {
  11.                 var uju = novo.substr(0, -paran)+"$"+novo.substr(-paran);
  12.                 value[i] = uju;                
  13.             }
  14.         }
  15.     var final = value.toString();
  16.     var resultado = final.replace(/,/g, "");
  17.     console.log("$" + resultado);
  18. }
  19. var x = ["hehe", "hoho", "haha", "hihi", "huhu"];
  20. var y = ["this", "is", "awesome"];
  21. var z = ["lorem", "ipsum", "dolor", "sit", "amet", ",", "consectetur", "adipiscing", "elit"];
  22. //print(x);
  23. /*  var lop = "hehe";
  24. var resultado = lop.substr(0, -4)+"$"+lop.substr(-4);
  25. console.log(resultado);   */
  26. print(x);
  27. print(y);
  28. print(z);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement