score:2

function o2s(o){ 
  var elm=new Option; 
  Object.keys(o).forEach(function(a){elm.style[a]=o[a];}); 
  return elm.getAttribute("style"); 
}

// test/usage:
o2s({
  fontSize: '4em',
  zIndex: 2,
  marginLeft: '-.5em'
});

// == "font-size: 4em; z-index: 2; margin-left: -0.5em;"

Related Query

More Query from same tag