weirdjava,
<script>
function generate(str) {
var arr = str.split(/\s+/);
var length = arr.length,
result = [],
temp;
for (var i = 2, j; i <= length; i++) {
j = length - i;
for (var k = 0; k <= j; k++) {
temp = arr.slice(k, k + i);
result.push(temp.join(" "))
}
}
return result
};
var str = "a main working website";
document.write(JSON.stringify(generate(str)));
</script>