Ask Question

Assume courseTitle = "Principles in Information Technology and Computation";

What does the following jа vascript statement do?

var something = courseTitle. search ('o');

It finds all o's and save them to variable something.

It saves the position of the first occurrence of "o" to variable something.

It saves the position of the last occurrence of "o" to variable something.

It will save a true or false to something depends on whether there is an 'o' in courseTitle.

+5
Answers (1)
  1. 30 January, 13:20
    0
    It saves the position of the first occurrence of "o" to variable something.

    Explanation:

    The search () method in jа vascript searches the expression or the string and returns the position of it's first occurrence and if not found it returns - 1.

    So in the code given above it will search for character o and returns the position of it's first occurrence that is 16 and if there were no o in the string then it would have returned - 1.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Assume courseTitle = "Principles in Information Technology and Computation"; What does the following jа vascript statement do? var ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers