0

The following will display the alert on my computer and on my Android using Firefox, but not on my Android using Chrome. I'm aware of some of the problems with Chrome when used on an Android, but this one had me up all night trying everything I can think of to get the alert to pop up when using Chrome on an Android. It's the only hangup in the program I wrote. What am I missing here?

var i = 0;
var test = "456";
var line = "";

for(i = 1; i <= 9; i++) {
    line += i;
}
line = line.toString();
if(line.contains(test)) {
    alert(line);
}

1 Answer 1

1

Probably because String.prototype.contains is experimental and part of EcmaScript 6 proposal.

Also checkout the Browser compatibility section on that same page.

Sign up to request clarification or add additional context in comments.

2 Comments

I'll use . . .if (line.indexOf("test") !=-1) {
I think it should be test not "test".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.