I would make this a closure method. Regarding performance I cannot give a clear answer. But you might want to experiment with http://jsperf.com/ which let you write code and run those against each other with timing information. 

The last if check in your example code doesn't look correct. It will never be a string so as of now the condition is always met.