0
0
Figmabi_tool~10 mins

Find and replace across files in Figma - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
Atype
Bname
Cstyle
Dcolor
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'type' instead of 'name' to find elements.
2fill in blank
medium

Complete 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'
A'New Text'
Bnode.characters
Cnode.characters.replace('Old', 'New')
Dnode.text
Attempts:
3 left
💡 Hint
Common Mistakes
Assigning a fixed string instead of calling replace.
3fill in blank
hard

Fix 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'
A'newText'
BOldText
Cn.characters
D'OldText'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around the search string.
4fill in blank
hard

Fill 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'
A'TEXT'
B'Old'
C'FRAME'
D'New'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'FRAME' instead of 'TEXT' for node type.
5fill in blank
hard

Fill 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'
A'TEXT'
BOldText
C/OldText/g
D'OldText'
Attempts:
3 left
💡 Hint
Common Mistakes
Using string instead of regex for replace.