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.addCancelAction("Back")
	al.title = `${c.givenName} ${c.familyName}`
	al.addAction("Call")
	al.addAction("Text")
	al.addAction("WhatsApp")
	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?

https://javascript.info/async-await

Thanks rob! Will try and report.

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