Replace All Spaces With Hyphen - in JavaScript

<script type="text/javascript">
var changeString="You can use Forget Code To Download Programming Snippets ";
alert(changeString.replace(/ /g,'-'));
</script>