1

Using my micro:bit I am trying to add the value of a variable called sendText to an array without overwriting its previous stored value for that variable.

input.onGesture(Gesture.Shake, () => {
    list.push(sendText)
    binSend = 0
    basic.showString(sendText)
})

My array is called list

let list: string[] = []

I am trying to store single characters in an array then outputting them. If there is a better alternative to using an array I would gladly accept it.

Heretic Monkey
  • 11,687
  • 7
  • 53
  • 122
greg-bt
  • 71
  • 7

1 Answers1

1

To add a value to an array you use push function, after, if you need to group the characters pushed to array for output you could to use for your specific example list.join('')