Complete the code to add a comment in Figma.
figma.currentPage.[1]('This is a note for the design')
In Figma's plugin API, createComment is used to add a comment to the current page.
Complete the code to select a frame by its name in Figma.
const frame = figma.currentPage.findOne(node => node.name === [1] && node.type === 'FRAME')
Strings in JavaScript must be enclosed in quotes. Double quotes "Main Frame" correctly represent the frame name.
Fix the error in the code to add a text node with documentation inside a frame.
const text = figma.createText();
text.characters = [1];
frame.appendChild(text);The characters property requires a string value, so the text must be enclosed in quotes.
Fill both blanks to create a rectangle and add a description as its plugin data.
const rect = figma.createRectangle(); rect.[1] = 100; rect.setPluginData('[2]', 'This rectangle is for layout')
The rectangle's width is set by the width property. Plugin data keys can be any string, here 'description' is used to store notes.
Fill all three blanks to add a comment with a message, author, and position.
figma.createComment({ message: [1], author: [2], clientMeta: { x: [3], y: 100 } })The message and author must be strings in quotes. The x coordinate is a number, here 50.