This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Brian Byle
Posted Jul 15 - Read on Facebook

Another quickie:

I saw a pice of code online:

for i in [0...5]
Inbox["face#{i + 1}"].scale = initialScale

I get WHAT it does, it iterates 5 times to set each face.scale layer to the value of initialScale.

My question is, what is that ["face#{i + 1}"] part? Is that shorthand for something? Googling this was very difficult.

Thx in advance!

2 Comments

Trevor Phillippi

what is inside of the braces is an expression that's evaluated, that is used to reference an object within an object (usually integers for arrays, and strings for JS objects.)

myFruit = "apple"
print "My color is " + fruits[myFruit].color

so myFruit is used as "apple" at runtime.

Brian Byle

Thx Trevor! That last piece is what I needed. Is this in the Docs?

Read the entire post on Facebook