link to PXT
This commit is contained in:
parent
4cd61cd96a
commit
bf57ba2902
@ -33,25 +33,5 @@ Visit the cards below to starting programming JavaScript and TypeScript with the
|
|||||||
## More information on TypeScript
|
## More information on TypeScript
|
||||||
|
|
||||||
You can write micro:bit programs in a subset of [TypeScript](https://www.typescriptlang.org), which is a superset of JavaScript.
|
You can write micro:bit programs in a subset of [TypeScript](https://www.typescriptlang.org), which is a superset of JavaScript.
|
||||||
Many micro:bit programs, especially at the beginner's level, are just plain JavaScript. TypeScript introduces class-based
|
Many micro:bit programs, especially at the beginner's level, are just plain JavaScript. See [more details](https://www.pxt.io/language)
|
||||||
object-oriented programming, such as:
|
on the subset of TypeScript supported.
|
||||||
|
|
||||||
```typescript
|
|
||||||
class Greeter {
|
|
||||||
greeting: string;
|
|
||||||
constructor(message: string) {
|
|
||||||
this.greeting = message;
|
|
||||||
}
|
|
||||||
greet() {
|
|
||||||
return "Hello, " + this.greeting;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let greeter = new Greeter("world");
|
|
||||||
basic.showString(greeter.greet())
|
|
||||||
```
|
|
||||||
|
|
||||||
This site is meant for teaching programming first, and JavaScript second. For this
|
|
||||||
reason, we have stayed away from concepts that are specific to JavaScript (for
|
|
||||||
example, prototype inheritance), and instead focused on ones common to most
|
|
||||||
modern programming languages (lexically scoped variables, functions, classes).
|
|
||||||
|
Loading…
Reference in New Issue
Block a user