linked linked linkedin whatsapp remove
Feedback

HTML 5 Quiz HTML 5

Which of the following code samples will correctly search for the word "for" in a string?

var str="This is test for javascript search !!!"; if(str.search("for") != -1) { alert("true"); } else { alert("false"); }

var str="This is test for javascript search !!!"; if(str.indexof("for") != -1) { alert("true"); } else { alert("false"); }

var str="This is test for javascript search !!!"; if(str.indexOf("for") != -1) { alert("true"); } else { alert("false"); }

var str="This is test for javascript search !!!"; if(str.contains("for") != -1) { alert("true"); } else { alert("false"); }

Answer:
var str="This is test for javascript search !!!"; if(str.search("for") != -1) { alert("true"); } else { alert("false"); }

Note: This Question is unanswered, help us to find answer for this one

Related HTML 5 Questions and Answers:

QUIZACK

Evaluate your skill level in just 10 minutes with QUIZACK smart test system.

Copyright © 2021 Quizack . © 2021 All rights reserved