Hi All I have an issue.
Im trying to get ‘u’ to be pushed into my resultArray but for some reason its not coming up. Please let me know what I can do
Hi there!
After changing the input to the example phrase, “turpentine and turtles,” it gives the expected result.
Your code does push u to resultArray.
As an aside, we notice you are using a reserved word as a variable name in line 1.
let input =
We would caution you against using any reserved words (built-in function and method names, built in global constants, and the likes). Just as we would not write,
list = []
we would not write,
input =
Both of those are built in functions.
lst = []
user = input()
Hopefully this has a meaningful impact on how you choose your variable names and you avoid running into problems in the future.
Having come back to my senses, there are no list
objects in JS; nor is there an input()
function. One’s mind was completely on another language.
let input = prompt("Are tomatoes a vegetable or a fruit?", "don't know")
The variable name is perfectly valid in JS and does not conflict. It can even be used to store the value attribute of an <input>
element.
Kind 'o blushing, just now.
I see
thank you all for replying it means a lot!