0
0
Figmabi_tool~10 mins

Batch operations and selection 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 select all layers on the current page.

Figma
figma.currentPage.selection = figma.currentPage.[1]();
Drag options to blanks, or click blank then click option'
AfindAll
BselectAll
CgetSelection
DgetAll
Attempts:
3 left
💡 Hint
Common Mistakes
Using getSelection() returns only currently selected layers, not all layers.
selectAll() is not a valid method in Figma plugin API.
2fill in blank
medium

Complete the code to remove all locked nodes from the current selection.

Figma
figma.currentPage.selection = figma.currentPage.selection.filter(node => node.[1] !== true);
Drag options to blanks, or click blank then click option'
AisLocked
Bvisible
Cremoved
Dselected
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'removed' property which does not exist.
Filtering by 'visible' does not remove locked nodes.
3fill in blank
hard

Complete the code to batch rename selected layers by adding a prefix.

Figma
figma.currentPage.selection.forEach(node => { node.name = '[1]' + node.name; });
Drag options to blanks, or click blank then click option'
Alayer_
Bnode_
Cprefix_
Dselected_
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable names instead of string literals.
Forgetting to add the underscore for clarity.
4fill in blank
hard

Fill both blanks to batch hide all selected layers and then clear the selection.

Figma
figma.currentPage.selection.forEach(node => { node.[1] = false; });
figma.currentPage.selection = [2];
Drag options to blanks, or click blank then click option'
Avisible
B[]
Cnull
DisHidden
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'isHidden' which is not a valid property.
Assigning null instead of an empty array to clear selection.
5fill in blank
hard

Fill all three blanks to batch duplicate selected layers, rename duplicates with suffix, and select duplicates.

Figma
const duplicates = figma.currentPage.selection.map(node => {
  const dup = node.[1]();
  dup.name = node.name + '[2]';
  node.parent.appendChild(dup);
  return dup;
});
figma.currentPage.selection = [3];
Drag options to blanks, or click blank then click option'
Aclone
B_copy
Cduplicates
Dduplicate
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'duplicate()' which is not a Figma node method.
Assigning the wrong variable to selection.