I have 2 arrays and I want to check if their strings match with each other. I am having problem with understanding this. how it is going to check the condition?
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
You cannot return outside of a function , and attempting to do so will throw a syntax error.
I am a bit confused about what you are asking, but the method indexOf either returns the index of a value that is strictly equal to the given argument or it returns -1 in which case you can conclude that no such value exists within the array.