I have been trying to create a bookmarklet to run quick javascript, and am having trouble doing so. I have tried
javascript:var runjs = prompt("Enter JS:");function runjs() {runjs};
it seems you want to do the following
javascript:eval(prompt("Enter JS:"));
this will evaluate (run) the code entered in the prompt
as per comment
javascript:try{eval(prompt("Enter JS:"));}catch(e){alert(e);}
this will catch most? errors