Here is some information about JS data structure: “Strings”.

For a complete list check MDN String Methods List: LINK

String Creation:


Storing Strings:

Multi-Line Strings:

  • Using: Shift + Enter  and use the “Tilde” to wrap the text.

  • Using the “Return Line Break Operator ”  —> “\n”

String Reverse

I have not found a direct build method to achieve this task but using a chain of methods including some for Arrays this get the job done.  another variation in 14-Reverse-Words.js  CodeWars-JS

String Concatenation:

  • Using the “+”

  • Using   .concat(x)

String Replacement:

Using basic  .replace

Using .replace()  +  Regular Expressions  +  “g” (Global Flag)

Changing the CASE of a String:

Cap the 1rst Letter of a string.


Cut Last Character of String:


Template Strings:

this are the ones that are contain inside Tildes and using ${}  what is inside of the braces is understood as JS.


.startsWith(“abc “);

Check if a Strings has any numbers on it, True – False


Strings —to—> Numbers:

  • parseInt(str)

  • parseFloat(str)

string to array every X characters

this will split the string every 2 characters, you can change the 2 for other number.




Copyright 2017. All rights reserved.

Posted January 29, 2017 by Edmundo in category "JS