1# Stopping a PageAbility
2
3
4The **terminateSelf()** method in the **featureAbility** class is used to stop a PageAbility.
5
6**Table 1** featureAbility APIs
7
8| API| Description|
9| -------- | -------- |
10| terminateSelf() | Terminates this ability.|
11| terminateSelfWithResult(parameter: AbilityResult) | Terminates this ability and returns the execution result.|
12
13
14The following code snippet shows how to stop an ability.
15
16```ts
17import featureAbility from '@ohos.ability.featureAbility';
18import hilog from '@ohos.hilog';
19
20const TAG: string = 'PagePageAbilityFirst';
21const domain: number = 0xFF00;
22```
23```ts
24//...
25(async (): Promise<void> => {
26  try {
27    hilog.info(domain, TAG, 'Begin to terminateSelf');
28    await featureAbility.terminateSelf();
29    hilog.info(domain, TAG, 'terminateSelf succeed');
30  } catch (error) {
31    hilog.error(domain, TAG, 'terminateSelf failed with ' + error);
32  }
33})()
34//...
35```
36