Home / CSE / Javascript - CS :: Discussion

Discussion :: Javascript - CS

  1. What would be the result of the following statement in JavaScript using regular expression methods ?

  2. A.

     Returns [“123″”456″”789”]

    B.

     Returns [“123″,”456″,”789”]

    C.

     Returns [1,2,3,4,5,6,7,8,9]

    D.

     Throws an exception

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    The split() method can take regular expressions as its arguments. The split() method generally breaks the string on which it is called into an array of substrings, using the argument as a separator.


Be The First To Comment