When I try printing the Var 'password'
it says
Error -1700: Can't convert types.
var app = Application.currentApplication();
app.includeStandardAdditions = true;
var text = Application('System Events')
//prompt
var password = app.displayDialog('enter your password', {defaultAnswer: " "});
text.keystroke(password)
//returned message is Error -1700: Can't convert types.