MCQs > IT & Programming > HTML 5 > Which code sample will correctly search for the word 'for' in a string?

HTML 5 MCQs

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

Answer

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

Explanation:

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

HTML 5 Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

HTML 5 Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it