C
C
celovec2019-07-23 00:12:45
PayPal
celovec, 2019-07-23 00:12:45

How to withdraw money from Paypal to Revolut?

As far as I understand it is impossible to do this directly.
Please tell me some third-party services through which this can be done.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Sokolov, 2017-11-04
@DJWOMS1

Create an object with the property areas : Take the array from the "mh" property of the source data. This is a JSON entry, so we just write

peremennaya = {...тут весь этот JSON...}
peremennaya.mh // тут нужный массив

From this array, you need to make a new one, where each element will contain only two properties: id and title . The first is taken from the original as is, and the second must be composed by collecting the values ​​of the title and count element properties separated by a space-hyphen-space: When you need to perform an action on each element of the array, the map() array method is convenient . A function is passed to it, which, receiving the next value from the array as input, does something with it and returns a new value. Total:
var d = {"mh": [{"id": "BR", "count": 18516, "title": "Brazil"}, 
    {"id": "US", "count": 4514, "title": "United States"}, 
    {"id": "MY", "count": 390, "title": "Malaysia"}, 
    {"id": "IT", "count": 208, "title": "Italy"}]
};

var result = {areas: d.mh.map(el => ({id:el.id, title:''+el.title+' - '+el.count}))}

// {"areas":[{"id":"BR","title":"Brazil - 18516"},{"id":"US","title":"United States - 4514"},
//   {"id":"MY","title":"Malaysia - 390"},{"id":"IT","title":"Italy - 208"}]}

A
Anton Mudrenok, 2017-11-04
@mudrenokanton

const some = { areas: mh.map((el) => ({ id: el.id, title: el.title })) }

E
Eugene Slavko, 2018-01-20
@e20860

The solution of this problem involves iterating over the elements of the array and creating transformed new values ​​on its basis.
Theory of the question: Simple and Smart
Simple (canonical - pre-ES6) options: An
existing object to transform is given.

// Имеем объект, представляющий из себя массив простых объектов   
oldObj = {"mh": [{"id": "BR", "count": 18516, "title": "Brazil"}, 
                 {"id": "US", "count": 4514, "title": "United States"}, 
                 {"id": "MY", "count": 390, "title": "Malaysia"}, 
                 {"id": "IT", "count": 208, "title": "Italy"}
                ]
};

1. Using the map method and creating a separate function:
// при желании функцию трансформации можно назвать конструктором со всеми вытекающими...
function transform(oO){
    var rv = {}; // return value
    rv.areas = oO.mh.map(function(str){
        var rs    = {};  // return string
        rs.id     = str.id;
        rs.title  = str.title + " - " + str.count;
        return rs;
    });
    return rv;
};
var newObj1 = transform(oldObj);
// В случае конструктора 
// var newObj1 = new Transform(oldObj)
console.log(newObj1);
// полученный объект

Option 1.2 Using the map method without creating a separate function:
var newObj2 = {};

newObj2.areas = oldObj.mh.map(function(str){
     var rs    = {};  // return string
     rs.id     = str.id;
     rs.title  = str.title + " - " + str.count;
     return rs;
});

2. 1Iterating an array (forEach) without the map method
var newObj3 = {"areas":[]};
oldObj.mh.forEach(function(str){
   var ps    = {};  // pushed string
   ps.id     = str.id;
   ps.title  = str.title + " - " + str.count;
   newObj3.areas.push(ps);
});

2.2 Iterating over an array using a for loop
var newObj4 = {"areas":[]};
for (var i = 0; i<oldObj.mh.length;i++) {
   var  str = oldObj.mh[i];
   var ps    = {};  
   ps.id     = str.id;
   ps.title  = str.title + " - " + str.count;
   newObj4.areas.push(ps);
}

Стрелочные функции, показанные в предыдущих ответах могут работать не во всех браузерах, хотя с точки зрения оптимизации кода - более эффективны...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question