I can’t call await within a function

I want to make my own little contacts app.
I created a function that creates an Alert with a single contacts info. However when I want to assign the promise within the function, it doesn’t seem to recognize the await keyword. My code and error is below.

My code:

// create single contact view
function singleContactView() {
	var c=dsa[ans]
	var al = new Alert()
	al.title = `${c.givenName} ${c.familyName}`
	var selection = await al.present()
        return selection

My error is:

Error on line 10: SyntaxError: Unexpected identifier 'al'. Expected ';' after variable declaration.

What if you add the async keyword to your function?


Thanks rob! Will try and report.

Forgot to mention that I’m a bit of a noob
Thanks Rob!