Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions 1-js/10-error-handling/2-custom-errors/1-format-error/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ importance: 5

---

# Inherit from SyntaxError
# ارث‌بری از SyntaxError

Create a class `FormatError` that inherits from the built-in `SyntaxError` class.
یک کلاس `FormatError` بسازید که از کلاس درون‌ساخت `SyntaxError` ارث‌بری می‌کند.

It should support `message`, `name` and `stack` properties.
این کلاس باید از ویژگی‌های `message`، `name` و `stack` پشتیبانی کند.

Usage example:
مثالی از کاربرد:

```js
let err = new FormatError("formatting error");
Expand All @@ -18,5 +18,5 @@ alert( err.name ); // FormatError
alert( err.stack ); // stack

alert( err instanceof FormatError ); // true
alert( err instanceof SyntaxError ); // true (because inherits from SyntaxError)
alert( err instanceof SyntaxError ); // true (ارث‌بری می‌کند SyntaxError چون از)
```
Loading