Which version of Acrobat are you using?
There is actually a syntax error in try67's code, but not what your console screenshot shows: The function to delete pages is "deletePages" and not "deletePage" - the "s" is missing. in line #8. Other than that it is working and does exactly what it's supposed to do.
Can you execute other code in the console? Try the following different snippets, do they work?
Test 1:
app.alert("Hello World!");
Test 2:
for (var i=3; i>=0; i--) {
app.alert("Countdown: " + i);
}
If you can make these two snippets work, then the script from above (after fixing the 'deletePage' error) should work as well. If you cannot make both of these snippets to run, then there is a problem with how you are trying to execute code in the console.