+ 3

Numbering sentences

Today I am trying to number the sentences of a text, what is missing? : var text = "ABC.DEF.XYZ"; for (i = 0, i < text.length, i++) { var response = text.split(".").join(" i "); } alert(response);

9th Jun 2019, 4:09 AM
Matthew S.
Matthew S. - avatar
2 Answers
+ 2
var text = "ABC.DEF.XYZ"; var arr = text.split("."); var response = ""; for (i = 0;i<arr.length;i++) { response += i + arr[i]; } alert(response); https://code.sololearn.com/WbOBS0Ss7WW2/?ref=app
9th Jun 2019, 4:33 AM
CalviŐČ
CalviŐČ - avatar
+ 1
Thank You very much :)
9th Jun 2019, 4:44 AM
Matthew S.
Matthew S. - avatar