Javascript and replace?

I’m trying to figure out how to replace empty spaces using replace…

I have tryid this but with no luck…

var seo_sc = new Array (
			  ' ','-','/','\\\\',',','#',':',';','\\'','"','[',']','%20','{','}',
			  ')','(','|','`','~','!','@','%','$','^','&','*','=','?','+');
var file = file.replace(seo_sc,'-',file);

Can this be done?

Try this:

file = file.replace(/\\s/g, '-');

or some other regular expression