You're just executing a string of code, so you're just adding strings together to make one big bit of text (which happens to also be a JavaScript command) - it's like you'd have if you were working with Strings in any language:
i=0;
print('digitalWrite(segs[i], 0)') prints digitalWrite(segs[i], 0)
print('digitalWrite(segs['+i+'], 0)') prints digitalWrite(segs[0], 0)
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
You're just executing a string of code, so you're just adding strings together to make one big bit of text (which happens to also be a JavaScript command) - it's like you'd have if you were working with Strings in any language: