Language Cheat Sheets
Essential syntax and methods for HTML, CSS, JavaScript, Python, SQL, and TypeScript — all in one place.
Document Structure
Declares HTML5 document
Root element
Metadata container
Visible page content
Character encoding
Browser tab title
Text & Headings
Headings (h1 = largest)
Paragraph
Bold / important text
Italic / emphasized text
Line break
Inline container
Links & Media
Hyperlink
Image
Video player
Audio player
Open link in new tab
Forms
Form container
Text input
Email input
Multi-line input
Dropdown
Submit button
Selectors
Universal selector
Type selector
Class selector
ID selector
Pseudo-class
Pseudo-element
Box Model
Space outside the border
Border around element
Space inside the border
Include padding in width
Element dimensions
Flexbox
Enable flexbox
row | column
Main axis alignment
Cross axis alignment
Space between flex items
Allow items to wrap
Grid
Enable CSS Grid
Define column tracks
Define row tracks
Gutter between rows and columns
Span across columns
Center in both axes
Variables
Block-scoped constant
Block-scoped variable
Function-scoped (avoid)
Get type as string
Array Methods
Transform each element
Keep matching elements
Reduce to single value
First matching element
True if any match
Flatten nested array
Async
Async function declaration
Wait for Promise to resolve
Promise chaining
Run promises in parallel
DOM
Select first matching element
Attach event handler
Toggle a CSS class
Get or set text content
Get or set HTML content
Data Types
String: 'hello', "world"
Integer and floating-point
True / False
Ordered, mutable: [1, 2, 3]
Key-value pairs: {'a': 1}
Ordered, immutable: (1, 2)
Control Flow
Conditional statement
Else-if branch
For loop
While loop
Exit or skip iteration
Functions
Function definition
Return a value
Anonymous function
Variable arguments
List Methods
Add item to end
Remove and return last item
Sort in place
Return sorted copy
[x*2 for x in lst if x > 0]
Basic Queries
Select all columns
Filter rows
Sort rows
Limit result rows
Remove duplicate rows
Joins
Rows matching in both tables
All rows from left table
All rows from right table
Join condition
Aggregates
Count rows
Sum of values
Average value
Group for aggregation
Filter grouped rows
Data Manipulation
Add new row
Modify existing rows
Remove rows
Create a new table
Modify table structure
Types
Primitive types
Array of strings
Opt out of type checking
Safe alternative to any
Value that never occurs
Function returns nothing
Interfaces & Types
Object shape declaration
Type alias
Union type
Intersection type
All fields optional
All fields required
Generics
Generic function
Generic array type
Type constraint
Keys of a type
Utility Types
Keep specified keys
Remove specified keys
All fields read-only
Object with typed keys
Return type of function
Learn deeper with tutorials
Browse full tutorials for any language — from beginner basics to advanced topics.
Browse Tutorials