Skip to content

Conversation

@jonahroth
Copy link

@maxdignan @kmodlich This was tricky because I'm trying to store different formats as functions and I didn't realize how this works in Javascript

function(name) { return name + " " + rnd(this.last_names); },
function(name) { return rnd(this.first_names) + " " + name.charAt(0).toUpperCase(); }
];
var formatter = rnd(formats).bind(this);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check out using apply in this case instead of bind - this way you can do 46 and 47 in one line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants