Should I Learn JavaScript Before Starting TypeScript?
Asked by
why the long syllabus
I've learned HTML and CSS for a website I want to build. After researching the project, I'm considering TypeScript, but I'm unsure whether to learn JavaScript first since it's usually recommended for beginners. Should I study JavaScript on its own, or begin with TypeScript and learn the JavaScript fundamentals along the way?
Answers
You can start with TypeScript if you prefer the extra structure. Its type checking catches many mistakes early and can encourage good habits, even for beginners. The tradeoff is that TypeScript doesnโt run directly in browsers, so youโll need a development setup that compiles it into JavaScript.
Reply to this answer
If you already know the project will become fairly large, using TypeScript from the beginning can save you a later migration. Converting an established JavaScript codebase isnโt impossible, but it can be tedious. Just make sure you still learn the underlying JavaScript concepts instead of treating TypeScript as a completely separate language.
Reply to this answer
TypeScript is essentially JavaScript with an additional type system, so learning either one will help you understand the other. Starting with JavaScript can be simpler because browsers run it directlyโyou can use a script tag or the browserโs developer console without setting up a compiler. Once youโre comfortable with the basics, adding TypeScript is usually straightforward.
Reply to this answer
TypeScript is useful, especially on larger team projects, but it can be frustrating when a library has incomplete or awkward type definitions. For a small first project, JavaScript may let you focus on learning the web fundamentals with less setup. For a serious long-term project, TypeScript is often worth the additional complexity.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Related Discussions