mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-27 23:04:05 -06:00
Add note
This commit is contained in:
parent
1f9c6ae76b
commit
99534d5d02
@ -4,7 +4,7 @@ tags:
|
||||
- basic
|
||||
- coding-language
|
||||
- MOC
|
||||
date: 2024-03-18
|
||||
date: 2024-03-27
|
||||
---
|
||||
|
||||
# Python
|
||||
@ -27,7 +27,8 @@ date: 2024-03-18
|
||||
|
||||
* [Plot UI components for MATLAB](computer_sci/coding_knowledge/matlab/uicontrol.md)
|
||||
|
||||
# JavaScript
|
||||
# JavaScript & TypeScript
|
||||
|
||||
*
|
||||
* [DOM](computer_sci/coding_knowledge/js/DOM.md)
|
||||
* [TypeScript vs. JavaScript](computer_sci/coding_knowledge/js/TypeScript_vs_JavaScript.md)
|
||||
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
---
|
||||
title: JavaScript vs. TypeScript
|
||||
tags:
|
||||
- coding-language
|
||||
- typescript
|
||||
- javascript
|
||||
- web
|
||||
date: 2024-03-27
|
||||
---
|
||||
|
||||
|
||||
**1. Typing:**
|
||||
|
||||
- **TypeScript:** Statically typed. You need to explicitly define the data types of variables and functions. This helps catch errors early in the development process.
|
||||
- **JavaScript:** Dynamically typed. Variables don't require explicit data type definition. This offers flexibility but can lead to runtime errors.
|
||||
|
||||
**2. Features:**
|
||||
|
||||
- **TypeScript:** Adds features like interfaces, classes, generics, and enums on top of JavaScript. These features improve code organization, readability, and maintainability for larger projects.
|
||||
- **JavaScript:** Lacks these features but has a vast ecosystem of libraries that can provide similar functionalities.
|
||||
|
||||
**3. Compilation:**
|
||||
|
||||
- **TypeScript:** Needs to be compiled to JavaScript before running in a browser. This compilation step adds another step to the development process.
|
||||
- **JavaScript:** Runs directly in the browser without any compilation needed.
|
||||
|
||||
**4. Choosing Between TypeScript and JavaScript:**
|
||||
|
||||
- **TypeScript:** Ideal for large-scale applications, projects requiring strong typing and better tooling support, and teams working collaboratively.
|
||||
- **JavaScript:** Preferred for smaller projects, rapid prototyping, or when flexibility and faster turnaround time are priorities.
|
||||
|
||||
| Feature | TypeScript | JavaScript |
|
||||
| ----------- | ---------------------------------------------- | ----------------------------------------------- |
|
||||
| Typing | Statically typed | Dynamically typed |
|
||||
| Features | Includes classes, interfaces, generics, enums | Relies on libraries for similar functionalities |
|
||||
| Compilation | Requires compilation to JavaScript | Runs directly in the browser |
|
||||
| Use Cases | Large-scale applications, strong typing needed | Smaller projects, rapid prototyping |
|
||||
| | | |
|
||||
Loading…
Reference in New Issue
Block a user