Использование indexOf (JavaScript) при работе с массивами и строками

JavaScript is a unique programming language and an integral component of the browser, its syntax and semantics so organically embody the best traditions of modern algorithm development that they are in many ways an example for other languages ​​that present similar capabilities in a more cumbersome version.

indexof javascript




JavaScript's indexOf method does not position itself as a search operation, but it can be used to determine where a character or substring is in a string. The same method applies to regular arrays.

General description of the method

The general style of JavaScript syntax determines that strings and arrays have an indexOf method that calculates where the desired substring (or just a character) begins in the string where this method was applied.

«». «var» , . - JavaScript.

, , , , .





: - «str», - «arr» - «ass». - id='scCurrInfo', . indexOf JavaScript .

() . .

Author's example is not a picture




JavaScript indexOf array : - . , , , indexOf array .

JavaScript: indexOf string.

Author's example is not a picture




, - . indexOf .





(, ) indexOf, JavaScript : , ().

, : ( ), (). .

, - «-1».

javascript indexof array




, , . , . . DOM - , indexOf JavaScript .

JavaScript, - , , « ».

, . , .

, , : : .

javascript indexof string




, , .

, , , indexOf .




All Articles