n8n Practice Labs & Exercises

n8n expressions are JavaScript. These labs cover $json, arrays, Luxon dates, optional chaining and the Code node โ€” with every answer checked by actually running it.

32 free labs ยท 0 solved by you

Beginner (14)

n8nBeginner

Extract Nested Email from Webhook JSON in n8n

Learn how to extract a deeply nested customer email from a Webhook JSON payload in n8n using dot notation.

n8nBeginner

Access the First Item of an Array in n8n

Learn how to use zero-based indexing in n8n expressions to get the first object in a JSON array.

n8nBeginner

Format Current Date as YYYY-MM-DD in n8n using Luxon

Practice using n8n's built-in $now Luxon variable to format dates for APIs and databases.

n8nBeginner

Clean and Lowercase Email Strings in n8n

Learn how to chain JavaScript string methods .trim() and .toLowerCase() inside n8n expressions.

n8nBeginner

Round Decimal Numbers in n8n using JavaScript Math

Practice rounding float numbers to two decimal places using Math.round() ortoFixed() in n8n.

n8nBeginner

Convert a String to Uppercase in n8n

Practice formatting country codes and IDs in uppercase with toUpperCase() in n8n expressions.

n8nBeginner

Split a String and Get the First Word in n8n

Learn how to extract a first name from a full name with split() in n8n expressions.

n8nBeginner

Check if a String Contains a Word in n8n

Learn how to detect keywords in text with includes() in n8n expressions and IF nodes.

n8nBeginner

Count Characters with length in n8n

Practice validating message length (e.g. for SMS limits) with the length property in n8n.

n8nBeginner

Count Items in an Array in n8n

Learn how to count array items with length in n8n, e.g. to skip emails without attachments.

n8nBeginner

Get the Last Element of an Array in n8n

Practice reading the last item of an array with at(-1) or last() in n8n expressions.

n8nBeginner

Set a Default Value with ?? in n8n

Practice providing fallback values for empty fields with the nullish coalescing operator in n8n.

n8nBeginner

Convert a String to a Number in n8n

Learn how to convert numeric strings to real numbers with parseInt() or Number() in n8n.

n8nBeginner

Convert an Object to a JSON String in n8n

Practice converting objects to JSON text with JSON.stringify() for HTTP bodies and logs in n8n.

Intermediate (13)

n8nIntermediate

Reference Data from a Previous Node in n8n

Learn how to use the $('Node Name') syntax in n8n to pull data from earlier steps in your workflow.

n8nIntermediate

Filter Active Users in n8n Code Node

Learn how to use JavaScript filter() method inside an n8n Code node to keep only active users.

n8nIntermediate

Parse JSON String Data in n8n

Learn how to use JSON.parse() inside n8n expressions to convert stringified JSON into an object.

n8nIntermediate

Use JavaScript Ternary Operator in n8n Expressions

Learn how to write shorthand if/else ternary conditions inside n8n expressions.

n8nIntermediate

Extract Domain Name from URL using JavaScript in n8n

Learn how to parse URLs using standard JavaScript URL constructor inside n8n expressions.

n8nIntermediate

Remove Characters with replaceAll() in n8n

Practice cleaning phone numbers by removing every dash with replaceAll() in n8n.

n8nIntermediate

Extract a Field from Every Object with map() in n8n

Learn how to turn an array of objects into an array of values using map() in n8n.

n8nIntermediate

Filter an Array of Objects in an n8n Expression

Practice keeping only matching objects in an array with filter() inside n8n expressions.

n8nIntermediate

Find One Object in an Array with find() in n8n

Learn how to look up a single record in an array by ID with find() in n8n expressions.

n8nIntermediate

Get All Field Names with Object.keys() in n8n

Practice listing the keys of a JSON object with Object.keys() in n8n โ€” handy for dynamic payloads.

n8nIntermediate

Avoid Errors on Missing Fields with Optional Chaining in n8n

Learn how to safely read nested fields that may not exist using ?. in n8n expressions.

n8nIntermediate

Find the Maximum Value in an Array in n8n

Practice getting the highest number in an array with Math.max() and the spread operator in n8n.

n8nIntermediate

Add Days to a Date with Luxon plus() in n8n

Learn how to calculate due dates and reminders by adding days to $now in n8n.

Advanced (5)

Functions covered