How do I get a random element of an array?

  • 0
    let myArray = ["Мультифора", "Сублимация", "Эпидерсия"];

    How can I get a random element from MyArray?
    JavaScript Anonymous, Nov 28, 2019

  • 1 Answers
  • 0
    console.log(
    myArray[
    Math.floor( Math.random() * myArray.length )
    ]
    );
    Elizabeth Romero

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!