1.hello.ts
function greeter(person) {
return 'Hello, ' + person
}
let user = 'Yee'
console.log(greeter(user))
2.手动编译
tsc ./hello.ts
3.在html文件中引入编译后的 hello.js
<!DOCTYPE html>
<html><body>
<script src="hello.js"></script>
</body></html>
1.hello.ts
function greeter(person) {
return 'Hello, ' + person
}
let user = 'Yee'
console.log(greeter(user))
2.手动编译
tsc ./hello.ts
3.在html文件中引入编译后的 hello.js
<!DOCTYPE html>
<html><body>
<script src="hello.js"></script>
</body></html>