JSX Cheatsheet
If you're just starting to learn JSX and expressions for After Effects, it can be overwhelming to remember all the syntax and concepts involved. That's why I've created this JSX cheatsheet as a quick reference guide to help you when you get stuck.
Declaration
In programming, a declaration is a statement that tells the computer what a particular variable or function is going to be named and what type of value it will hold or return. To declare a variable in JavaScript, use the var
keyword followed by the variable name. You can declare multiple variables in one line by separating them with a comma.
Initialization
Initialization is the process of giving a variable its first value when it is created. When you declare a variable, the computer sets aside a specific amount of memory to store its value. Initialization is the act of assigning a value to that memory location. To initialize a variable, assign a value to it using the = operator. You can initialize an array with multiple values using square brackets [] and separating the values with commas.
String
Strings are used to represent text in JavaScript.
For-Loops
For-loops are used to iterate over a block of code multiple times.
While Loops
While-loops are used to iterate over a block of code as long as a particular condition remains true.
If/Else Statements
If/else statements are used to execute different blocks of code depending on whether a condition is true or false.
Shorthand If Statement
The shorthand if statement is used when you want to return a value based on a condition.
Ternary
Ternary operations are a shorthand way to write if/else statements and return a value based on a condition.
Function
A function is a block of code in programming that performs a specific task or set of tasks. It's like a reusable mini-program within a larger program. Imagine them as a pre-compositions in After Effects.
Functions are designed to take some input (known as arguments or parameters), process that input, and then return an output or perform an action.
Similar to variables, functions must be declared. In the below example, a function double
that accepts an argument called x
and returns the double of x :
Object
Objects in JavaScript are used to store collections of key/value pairs.
Single Line Comment
Single line comments are used to add comments to your code that will not be executed.
Multi-Line Comment
Multi-line comments are used to add comments to your code that span multiple lines.
Regular Expressions (Regex)
Regular expressions are patterns used to match character combinations in strings.
Additional Readings
JavaScript
Regex
Last updated