Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to start a find operation in Figma.
Figma
figma.currentPage.findAll(n => n.[1] === 'Button')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'type' instead of 'name' to find elements.
✗ Incorrect
Use name to find nodes by their name in Figma.
2fill in blank
mediumComplete the code to replace text in all found nodes.
Figma
for (const node of nodes) { if (node.type === 'TEXT') { node.characters = [1]; } }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Assigning a fixed string instead of calling replace.
✗ Incorrect
To replace text, use node.characters.replace('Old', 'New') to compute the new content and assign it back to node.characters.
3fill in blank
hardFix the error in the code to find and replace text across files.
Figma
const nodes = figma.root.findAll(n => n.type === 'TEXT' && n.characters.includes([1]));
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around the search string.
✗ Incorrect
The search string must be a quoted string literal like 'OldText'.
4fill in blank
hardFill both blanks to filter text nodes and replace their content.
Figma
const textNodes = figma.root.findAll(n => n.type === [1] && n.characters.includes([2]));
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'FRAME' instead of 'TEXT' for node type.
✗ Incorrect
Use 'TEXT' to filter text nodes and 'Old' as the search string.
5fill in blank
hardFill all three blanks to find text nodes, check for old text, and replace it.
Figma
const nodes = figma.root.findAll(n => n.type === [1] && n.characters.includes([2])); for (const node of nodes) { node.characters = node.characters.replace([3], 'NewText'); }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using string instead of regex for replace.
✗ Incorrect
Use 'TEXT' for node type, 'OldText' as string to check, and /OldText/g as regex to replace all occurrences.