Js [2] The composition and number of an array

// value key value is a first array in an array 
let arr1 = [ 'memory', 'color', 'size' ]; 
the let arr2 is = [l, 2,3 ]; 
the let TEMP = arr1.map ((value, index, ARR) => { 
    the let JSON = {}; 
    JSON [value] = arr2 is [index]
     return JSON 
}); 
the console.log (TEMP); 

// second array of a target value [ 'desc'] value is an array of objects [ 'name'] value of             
the let arr1.map Result = ((value, index) => ({desc: value, name: arr2 is [index]} )); 
the console.log (Result);

 

Guess you like

Origin www.cnblogs.com/websmile/p/11791677.html