I am new to javascript, but is this valid?
<script type="text/javascript">
if (condition()) {
location = "http://example.com/foo/bar/baz";
}
function condition()
{
if(something)
return true
else
return false
</script>
I am trying to write a javascript that goes insdie of content editer web part inside of SharePoint. Thanks.