Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Docs: Update 'File Read and Write' and 'Class and Object' Sections for Clarity and Accuracy #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
luckrnx09 merged 2 commits into luckrnx09:main from baekilda:refactor/file_and_class_section
Jan 2, 2024
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
2 changes: 1 addition & 1 deletion docs/class-and-instance.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ console.log(circle.getArea()); // 78.53981633974483
console.log(circle.getCircumference()); // 31.41592653589793
```
:::tip
The `static` keyword in the class is not native to JavaScript, but a feature provided by TypeScript. In addition to `static`, TypeScript also provides access modifiers such as `public`, `private`, and `protected`.
The `static` keyword in classes is a feature provided by TypeScript, but starting from ES2022, it has been [natively supported](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/static) in JavaScript. In addition, TypeScript also provides access modifiers such as `public`, `private`, and `protected`.
:::

#### Python implementation
Expand Down
9 changes: 4 additions & 5 deletions docs/read-and-write-files.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ const missingClassics = classics.filter(classic => !books.includes(classic));

if (missingClassics.length === 0) {
console.log('The file already contains the four great classical novels of China.');
return;
} else {
const missingClassicsText = missingClassics.join('\n');
fs.appendFileSync('books.txt', `\n${missingClassicsText}`, 'utf8');
console.log(`The missing novels have been added to the file: ${missingClassicsText}`);
}

const missingClassicsText = missingClassics.join('\n');
fs.appendFileSync('books.txt', `\n${missingClassicsText}`, 'utf8');
console.log(`The missing novels have been added to the file: ${missingClassicsText}`);
```

#### Python implementation
Expand Down
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ console.log(circle.getArea()); // 78.53981633974483
console.log(circle.getCircumference()); // 31.41592653589793
```
:::tip
class 中的 `static` 关键字并非 JavaScript 原生支持的,而是由 TypeScript 提供的特性,除此之外还提供了 `public`、`private`、`protected` 访问修饰符。
class 中的 `static` 关键字原来是 TypeScript 提供的特性,但从 ES2022 起已经在JavaScript中[原生支持](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Classes/static)了。 除此之外,TypeScript 还提供了 `public`、`private`、`protected` 访问修饰符。
:::

#### Python 实现
Expand Down
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ const missingClassics = classics.filter(classic => !books.includes(classic));

if (missingClassics.length === 0) {
console.log('文件中已包含中国四大名著。');
return;
} else {
const missingClassicsText = missingClassics.join('\n');
fs.appendFileSync('books.txt', `\n${missingClassicsText}`, 'utf8');
console.log(`已补充缺失的名著到文件中: ${missingClassicsText}`);
}

const missingClassicsText = missingClassics.join('\n');
fs.appendFileSync('books.txt', `\n${missingClassicsText}`, 'utf8');
console.log(`已补充缺失的名著到文件中: ${missingClassicsText}`);
```

#### Python 实现
Expand Down

AltStyle によって変換されたページ (->オリジナル) /