Write a JavaScript program to return the object associating the properties to the values of a given array of valid property identifiers and an array of values
- برمجة جافاسكربت java script
- برمجة
- 2021-06-03
- ahmadghneem
الأجوبة
const zipObject = (props, values) =>
props.reduce((obj, prop, index) => ((obj[prop] = values[index]), obj), {});
console.log(zipObject(['a', 'b', 'c'], [1, 2]));
console.log(zipObject(['a', 'b'], [1, 2, 3]));
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال