#random word generator in vue is working
6 messages · Page 1 of 1 (latest)
It's been a while since I worked with PHP, but if I understand your code correctly, it looks like you are maybe trying to access the randomnum property of an object as if it's a string, indexing it with a randomly-generated value in the range 0-51?
Hint 1: ||In the definition of randomnum, it's being initialized as an array containing only one element.||
Hint 2: ||What happens if you change randomnum to be just the string? In other words, remove the square brackets from the string.||
tried both approaches
What is it that you are trying to do and what is it that your code is doing? Also, can you supply more code so we can see what the context is?
Strings are automatically indexed. For example, try this: let myString = "abc" console.log(myString[1])
Also, your loop seems to be assigning b, d and f three times. Once is probably enough.