Complete the code to select the tool for drawing rectangles in Figma's toolbar.
toolbar.selectTool('[1]')
In Figma, the rectangle tool is selected by using 'rectangle' as the tool name.
Complete the code to get the name of the top layer in the layers panel.
topLayerName = layersPanel.layers[[1]].nameThe top layer is at index 0 in the layers array.
Fix the error in the code to change the opacity property of the selected layer.
selectedLayer.properties.opacity = [1]Opacity values are decimals between 0 and 1, so 0.5 means 50% opacity.
Fill both blanks to add a new layer named 'Button' and set its visible property to true.
newLayer = layersPanel.addLayer(name=[1], visible=[2])
The new layer's name should be 'Button' and visibility set to true to show it.
Fill all three blanks to filter layers by type 'frame', sort them by name, and get the first layer's id.
frameLayers = layersPanel.layers.filter(layer => layer.type === [1]).sort((a, b) => a.name.[2](b.name)); firstLayerId = frameLayers[[3]].id
Filter by 'frame' type, sort by name using localeCompare, and get the first layer at index 0.