1. Home
  2. /
  3. TypeScript
  4. /
  5. Tabs Navigation

Tabs Navigation - TypeScript Typing CST Test

Loading…

Tabs Navigation — TypeScript Code

Implements tab navigation with type-safe event handling and dynamic content switching.

document.addEventListener('DOMContentLoaded', () => {
	const tabs = document.querySelectorAll('.tab') as NodeListOf<HTMLButtonElement>;
	const contents = document.querySelectorAll('.content') as NodeListOf<HTMLElement>;
	tabs.forEach((tab, idx) => {
		tab.addEventListener('click', () => {
		contents.forEach(c => c.style.display = 'none');
		contents[idx].style.display = 'block';
		});
	});
});

TypeScript Language Guide

TypeScript is a statically typed superset of JavaScript that enhances developer productivity, scalability, and reliability by adding static types, modern tooling, and advanced language features while compiling to plain JavaScript for any runtime.

Primary Use Cases

  • ▸Large-scale frontend development
  • ▸Backend APIs with Node.js, Deno, or Bun
  • ▸Cross-platform mobile apps with React Native
  • ▸Cloud functions and serverless workloads
  • ▸Library and SDK development
  • ▸Type-safe dev tooling and automation scripts

Notable Features

  • ▸Static typing with strong type inference
  • ▸Interfaces, generics, and advanced type system
  • ▸Decorators and metadata reflection
  • ▸Namespaces and ES module support
  • ▸Union, intersection, and mapped types
  • ▸Excellent tooling via VS Code

Origin & Creator

Created by Microsoft under the leadership of Anders Hejlsberg (creator of C#), first released publicly in 2012. Initially invented to solve JavaScript scalability issues in large applications. Evolved through major versions adding classes, modules, generics, decorators, async/await support, strict mode, union types, mapped types, and powerful type inference.

Industrial Note

TypeScript dominates enterprise-scale frontend engineering, powering frameworks like Angular, Next.js, React, Vue, Bun, Deno, and many internal developer tools at companies such as Microsoft, Google, Airbnb, Shopify, Stripe, and Meta.

More TypeScript Typing Exercises

TypeScript Theme Toggle and CounterTypeScript Form ValidationTypeScript To-Do ListTypeScript Modal ExampleTypeScript Fetch API ExampleTypeScript Image SliderTypeScript Countdown TimerTypeScript Drag and Drop ExampleTypeScript Modal with Async Data

Practice Other Languages

CReactPythonC++RustKotlinPHPJavaC#RubyMqlCqlN1qlCypherGremlin