javascript - Get characters in string at positions [1] and [2] -


i know can 1 character of string giving .charat() index position of character.

but there method can give range (e.g. position 1 position 2 ) , respective characters?

use substring().

var str = "hello world!"; var res = str.substring(1, 5); //'ello' result 

if want chars, split , array.

arr = res.split('') //["e", "l", "l", "o"] result 

Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -