Skip to content

Instantly share code, notes, and snippets.

@nanasess
Created February 28, 2014 11:55
Show Gist options
  • Save nanasess/9269850 to your computer and use it in GitHub Desktop.
Save nanasess/9269850 to your computer and use it in GitHub Desktop.
example for map.
$(function() {
var $select = $('<select name="test" />');
var arr = [{'name':'Pizza'},{'name':'Pasta'},{'name':'Pizza2'}];
$select.append(arr.map(function(v, i, obj) {
return '<option value="' + i + '">' + v.name + '</option>';
}));
window.console.log($select);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment