JSFiddle - React, Tailwind, and code Playground

by prozoroff

JavaScript

const styles = [
  { fontSize: '12px', fontFamily: 'Arial' },
  { fontFamily: 'Verdana', fontStyle: 'italic', fontWeight: 'bold' },
  { fontFamily: 'Tahoma', fontStyle: 'normal'}
];

const getFontFamily = s => s.fontFamily;
const a = styles.map(getFontFamily); //["Arial","Verdana","Tahoma"]

const concatenate = (a, s) => ({...a, ...s});
const c = styles.reduce(concatenate, {});

const delegate = (a, b) => Object.assign(Object.create(a), b);
const d = styles.reduceRight(delegate, {});





console.log(Object.keys(d))